@@ -40,11 +40,11 @@ bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctio
40
40
response = soap_xmlParseMemory (buffer , buffer_size );
41
41
42
42
if (!response ) {
43
- add_soap_fault (this_ptr , "Client" , "looks like we got no XML document" , NULL , NULL );
43
+ add_soap_fault (this_ptr , "Client" , "looks like we got no XML document" , NULL , NULL , SOAP_GLOBAL ( lang_en ) );
44
44
return false;
45
45
}
46
46
if (xmlGetIntSubset (response ) != NULL ) {
47
- add_soap_fault (this_ptr , "Client" , "DTD are not supported by SOAP" , NULL , NULL );
47
+ add_soap_fault (this_ptr , "Client" , "DTD are not supported by SOAP" , NULL , NULL , SOAP_GLOBAL ( lang_en ) );
48
48
xmlFreeDoc (response );
49
49
return false;
50
50
}
@@ -63,32 +63,32 @@ bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctio
63
63
envelope_ns = SOAP_1_2_ENV_NAMESPACE ;
64
64
soap_version = SOAP_1_2 ;
65
65
} else {
66
- add_soap_fault (this_ptr , "VersionMismatch" , "Wrong Version" , NULL , NULL );
66
+ add_soap_fault (this_ptr , "VersionMismatch" , "Wrong Version" , NULL , NULL , SOAP_GLOBAL ( lang_en ) );
67
67
xmlFreeDoc (response );
68
68
return false;
69
69
}
70
70
}
71
71
trav = trav -> next ;
72
72
}
73
73
if (env == NULL ) {
74
- add_soap_fault (this_ptr , "Client" , "looks like we got XML without \"Envelope\" element" , NULL , NULL );
74
+ add_soap_fault (this_ptr , "Client" , "looks like we got XML without \"Envelope\" element" , NULL , NULL , SOAP_GLOBAL ( lang_en ) );
75
75
xmlFreeDoc (response );
76
76
return false;
77
77
}
78
78
79
79
attr = env -> properties ;
80
80
while (attr != NULL ) {
81
81
if (attr -> ns == NULL ) {
82
- add_soap_fault (this_ptr , "Client" , "A SOAP Envelope element cannot have non Namespace qualified attributes" , NULL , NULL );
82
+ add_soap_fault (this_ptr , "Client" , "A SOAP Envelope element cannot have non Namespace qualified attributes" , NULL , NULL , SOAP_GLOBAL ( lang_en ) );
83
83
xmlFreeDoc (response );
84
84
return false;
85
85
} else if (attr_is_equal_ex (attr ,"encodingStyle" ,SOAP_1_2_ENV_NAMESPACE )) {
86
86
if (soap_version == SOAP_1_2 ) {
87
- add_soap_fault (this_ptr , "Client" , "encodingStyle cannot be specified on the Envelope" , NULL , NULL );
87
+ add_soap_fault (this_ptr , "Client" , "encodingStyle cannot be specified on the Envelope" , NULL , NULL , SOAP_GLOBAL ( lang_en ) );
88
88
xmlFreeDoc (response );
89
89
return false;
90
90
} else if (strcmp ((char * )attr -> children -> content , SOAP_1_1_ENC_NAMESPACE ) != 0 ) {
91
- add_soap_fault (this_ptr , "Client" , "Unknown data encoding style" , NULL , NULL );
91
+ add_soap_fault (this_ptr , "Client" , "Unknown data encoding style" , NULL , NULL , SOAP_GLOBAL ( lang_en ) );
92
92
xmlFreeDoc (response );
93
93
return false;
94
94
}
@@ -120,33 +120,33 @@ bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctio
120
120
trav = trav -> next ;
121
121
}
122
122
if (body == NULL ) {
123
- add_soap_fault (this_ptr , "Client" , "Body must be present in a SOAP envelope" , NULL , NULL );
123
+ add_soap_fault (this_ptr , "Client" , "Body must be present in a SOAP envelope" , NULL , NULL , SOAP_GLOBAL ( lang_en ) );
124
124
xmlFreeDoc (response );
125
125
return false;
126
126
}
127
127
attr = body -> properties ;
128
128
while (attr != NULL ) {
129
129
if (attr -> ns == NULL ) {
130
130
if (soap_version == SOAP_1_2 ) {
131
- add_soap_fault (this_ptr , "Client" , "A SOAP Body element cannot have non Namespace qualified attributes" , NULL , NULL );
131
+ add_soap_fault (this_ptr , "Client" , "A SOAP Body element cannot have non Namespace qualified attributes" , NULL , NULL , SOAP_GLOBAL ( lang_en ) );
132
132
xmlFreeDoc (response );
133
133
return false;
134
134
}
135
135
} else if (attr_is_equal_ex (attr ,"encodingStyle" ,SOAP_1_2_ENV_NAMESPACE )) {
136
136
if (soap_version == SOAP_1_2 ) {
137
- add_soap_fault (this_ptr , "Client" , "encodingStyle cannot be specified on the Body" , NULL , NULL );
137
+ add_soap_fault (this_ptr , "Client" , "encodingStyle cannot be specified on the Body" , NULL , NULL , SOAP_GLOBAL ( lang_en ) );
138
138
xmlFreeDoc (response );
139
139
return false;
140
140
} else if (strcmp ((char * )attr -> children -> content , SOAP_1_1_ENC_NAMESPACE ) != 0 ) {
141
- add_soap_fault (this_ptr , "Client" , "Unknown data encoding style" , NULL , NULL );
141
+ add_soap_fault (this_ptr , "Client" , "Unknown data encoding style" , NULL , NULL , SOAP_GLOBAL ( lang_en ) );
142
142
xmlFreeDoc (response );
143
143
return false;
144
144
}
145
145
}
146
146
attr = attr -> next ;
147
147
}
148
148
if (trav != NULL && soap_version == SOAP_1_2 ) {
149
- add_soap_fault (this_ptr , "Client" , "A SOAP 1.2 envelope can contain only Header and Body" , NULL , NULL );
149
+ add_soap_fault (this_ptr , "Client" , "A SOAP 1.2 envelope can contain only Header and Body" , NULL , NULL , SOAP_GLOBAL ( lang_en ) );
150
150
xmlFreeDoc (response );
151
151
return false;
152
152
}
@@ -155,16 +155,16 @@ bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctio
155
155
attr = head -> properties ;
156
156
while (attr != NULL ) {
157
157
if (attr -> ns == NULL ) {
158
- add_soap_fault (this_ptr , "Client" , "A SOAP Header element cannot have non Namespace qualified attributes" , NULL , NULL );
158
+ add_soap_fault (this_ptr , "Client" , "A SOAP Header element cannot have non Namespace qualified attributes" , NULL , NULL , SOAP_GLOBAL ( lang_en ) );
159
159
xmlFreeDoc (response );
160
160
return false;
161
161
} else if (attr_is_equal_ex (attr ,"encodingStyle" ,SOAP_1_2_ENV_NAMESPACE )) {
162
162
if (soap_version == SOAP_1_2 ) {
163
- add_soap_fault (this_ptr , "Client" , "encodingStyle cannot be specified on the Header" , NULL , NULL );
163
+ add_soap_fault (this_ptr , "Client" , "encodingStyle cannot be specified on the Header" , NULL , NULL , SOAP_GLOBAL ( lang_en ) );
164
164
xmlFreeDoc (response );
165
165
return false;
166
166
} else if (strcmp ((char * )attr -> children -> content , SOAP_1_1_ENC_NAMESPACE ) != 0 ) {
167
- add_soap_fault (this_ptr , "Client" , "Unknown data encoding style" , NULL , NULL );
167
+ add_soap_fault (this_ptr , "Client" , "Unknown data encoding style" , NULL , NULL , SOAP_GLOBAL ( lang_en ) );
168
168
xmlFreeDoc (response );
169
169
return false;
170
170
}
@@ -177,6 +177,7 @@ bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctio
177
177
fault = get_node_ex (body -> children ,"Fault" ,envelope_ns );
178
178
if (fault != NULL ) {
179
179
char * faultcode = NULL ;
180
+ zend_string * lang = ZSTR_EMPTY_ALLOC ();
180
181
zend_string * faultstring = NULL , * faultactor = NULL ;
181
182
zval details ;
182
183
xmlNodePtr tmp ;
@@ -219,13 +220,19 @@ bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctio
219
220
220
221
tmp = get_node (fault -> children ,"Reason" );
221
222
if (tmp != NULL && tmp -> children != NULL ) {
222
- /* TODO: lang attribute */
223
223
tmp = get_node (tmp -> children ,"Text" );
224
224
if (tmp != NULL && tmp -> children != NULL ) {
225
225
zval zv ;
226
226
master_to_zval (& zv , get_conversion (IS_STRING ), tmp );
227
227
convert_to_string (& zv )
228
228
faultstring = Z_STR (zv );
229
+
230
+ /* xml:lang is required by SOAP 1.2, but for BC reasons we allow it to be missing */
231
+ xmlAttrPtr lang_attr = get_attribute_ex (tmp -> properties , "lang" , (const char * ) XML_XML_NAMESPACE );
232
+ if (lang_attr != NULL && lang_attr -> children != NULL ) {
233
+ const char * lang_str = (const char * ) lang_attr -> children -> content ;
234
+ lang = zend_string_init (lang_str , strlen (lang_str ), false);
235
+ }
229
236
}
230
237
}
231
238
@@ -234,13 +241,14 @@ bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctio
234
241
master_to_zval (& details , NULL , tmp );
235
242
}
236
243
}
237
- add_soap_fault (this_ptr , faultcode , faultstring ? ZSTR_VAL (faultstring ) : NULL , faultactor ? ZSTR_VAL (faultactor ) : NULL , & details );
244
+ add_soap_fault (this_ptr , faultcode , faultstring ? ZSTR_VAL (faultstring ) : NULL , faultactor ? ZSTR_VAL (faultactor ) : NULL , & details , lang );
238
245
if (faultstring ) {
239
246
zend_string_release_ex (faultstring , 0 );
240
247
}
241
248
if (faultactor ) {
242
249
zend_string_release_ex (faultactor , 0 );
243
250
}
251
+ zend_string_release_ex (lang , false);
244
252
if (Z_REFCOUNTED (details )) {
245
253
Z_DELREF (details );
246
254
}
0 commit comments