@@ -104,7 +104,7 @@ static void set_ns_and_type(xmlNodePtr node, encodeTypePtr type);
104104 return zval; \
105105 } \
106106 if (xml->properties) { \
107- null = get_attribute (xml->properties, "nil"); \
107+ null = get_attribute_ex (xml->properties, "nil", XSI_NAMESPACE ); \
108108 if (null) { \
109109 ZVAL_NULL(zval); \
110110 return zval; \
@@ -287,13 +287,7 @@ static bool soap_check_zval_ref(zval *data, xmlNodePtr node) {
287287 return 0 ;
288288 }
289289 if (SOAP_GLOBAL (soap_version ) == SOAP_1_1 ) {
290- while (1 ) {
291- attr = get_attribute (attr , "id" );
292- if (attr == NULL || attr -> ns == NULL ) {
293- break ;
294- }
295- attr = attr -> next ;
296- }
290+ attr = get_attribute (attr , "id" );
297291 if (attr ) {
298292 id = (char * )attr -> children -> content ;
299293 smart_str_appendc (& prefix , '#' );
@@ -1530,7 +1524,7 @@ static zval *to_zval_object_ex(zval *ret, encodeTypePtr type, xmlNodePtr data, z
15301524
15311525 ZEND_HASH_FOREACH_PTR (sdlType -> attributes , attr ) {
15321526 if (attr -> name ) {
1533- xmlAttrPtr val = get_attribute (data -> properties , attr -> name );
1527+ xmlAttrPtr val = get_attribute_any_ns (data -> properties , attr -> name );
15341528 char * str_val = NULL ;
15351529
15361530 if (val && val -> children && val -> children -> content ) {
@@ -2485,6 +2479,26 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod
24852479 return xmlParam ;
24862480}
24872481
2482+ static xmlAttrPtr get_soap_1_1_enc_attribute (xmlAttrPtr props , const char * name )
2483+ {
2484+ return get_attribute_ex (props , name , SOAP_1_1_ENC_NAMESPACE );
2485+ }
2486+
2487+ static xmlAttrPtr get_soap_1_2_enc_attribute (xmlAttrPtr props , const char * name )
2488+ {
2489+ return get_attribute_ex (props , name , SOAP_1_2_ENC_NAMESPACE );
2490+ }
2491+
2492+ /* Be forgiving for BC */
2493+ static xmlAttrPtr get_soap_enc_attribute (xmlAttrPtr props , const char * name )
2494+ {
2495+ xmlAttrPtr res = get_soap_1_1_enc_attribute (props , name );
2496+ if (!res ) {
2497+ res = get_soap_1_2_enc_attribute (props , name );
2498+ }
2499+ return res ;
2500+ }
2501+
24882502static zval * to_zval_array (zval * ret , encodeTypePtr type , xmlNodePtr data )
24892503{
24902504 xmlNodePtr trav ;
@@ -2501,7 +2515,7 @@ static zval *to_zval_array(zval *ret, encodeTypePtr type, xmlNodePtr data)
25012515 FIND_XML_NULL (data , ret );
25022516
25032517 if (data &&
2504- (attr = get_attribute (data -> properties ,"arrayType" )) &&
2518+ (attr = get_soap_enc_attribute (data -> properties ,"arrayType" )) &&
25052519 attr -> children && attr -> children -> content ) {
25062520 const char * type ;
25072521 char * end , * ns ;
@@ -2521,7 +2535,7 @@ static zval *to_zval_array(zval *ret, encodeTypePtr type, xmlNodePtr data)
25212535 }
25222536 if (ns ) {efree (ns );}
25232537
2524- } else if ((attr = get_attribute (data -> properties ,"itemType" )) &&
2538+ } else if ((attr = get_soap_enc_attribute (data -> properties ,"itemType" )) &&
25252539 attr -> children &&
25262540 attr -> children -> content ) {
25272541 const char * type ;
@@ -2535,7 +2549,7 @@ static zval *to_zval_array(zval *ret, encodeTypePtr type, xmlNodePtr data)
25352549 }
25362550 if (ns ) {efree (ns );}
25372551
2538- if ((attr = get_attribute (data -> properties ,"arraySize" )) &&
2552+ if ((attr = get_soap_enc_attribute (data -> properties ,"arraySize" )) &&
25392553 attr -> children && attr -> children -> content ) {
25402554 dimension = calc_dimension_12 ((char * )attr -> children -> content );
25412555 dims = get_position_12 (dimension , (char * )attr -> children -> content );
@@ -2544,7 +2558,7 @@ static zval *to_zval_array(zval *ret, encodeTypePtr type, xmlNodePtr data)
25442558 * dims = 0 ;
25452559 }
25462560
2547- } else if ((attr = get_attribute (data -> properties ,"arraySize" )) &&
2561+ } else if ((attr = get_soap_enc_attribute (data -> properties ,"arraySize" )) &&
25482562 attr -> children && attr -> children -> content ) {
25492563
25502564 dimension = calc_dimension_12 ((char * )attr -> children -> content );
@@ -2623,7 +2637,7 @@ static zval *to_zval_array(zval *ret, encodeTypePtr type, xmlNodePtr data)
26232637 pos = safe_emalloc (sizeof (int ), dimension , 0 );
26242638 memset (pos ,0 ,sizeof (int )* dimension );
26252639 if (data &&
2626- (attr = get_attribute (data -> properties ,"offset" )) &&
2640+ (attr = get_soap_enc_attribute (data -> properties ,"offset" )) &&
26272641 attr -> children && attr -> children -> content ) {
26282642 char * tmp = strrchr ((char * )attr -> children -> content ,'[' );
26292643
@@ -2639,7 +2653,7 @@ static zval *to_zval_array(zval *ret, encodeTypePtr type, xmlNodePtr data)
26392653 if (trav -> type == XML_ELEMENT_NODE ) {
26402654 int i ;
26412655 zval tmpVal , * ar ;
2642- xmlAttrPtr position = get_attribute (trav -> properties ,"position" );
2656+ xmlAttrPtr position = get_soap_enc_attribute (trav -> properties ,"position" );
26432657
26442658 ZVAL_NULL (& tmpVal );
26452659 master_to_zval (& tmpVal , enc , trav );
@@ -2854,9 +2868,9 @@ static zval *guess_zval_convert(zval *ret, encodeTypePtr type, xmlNodePtr data)
28542868 /* Logic: has children = IS_OBJECT else IS_STRING */
28552869 xmlNodePtr trav ;
28562870
2857- if (get_attribute (data -> properties , "arrayType" ) ||
2858- get_attribute (data -> properties , "itemType" ) ||
2859- get_attribute (data -> properties , "arraySize" )) {
2871+ if (get_soap_enc_attribute (data -> properties , "arrayType" ) ||
2872+ get_soap_enc_attribute (data -> properties , "itemType" ) ||
2873+ get_soap_enc_attribute (data -> properties , "arraySize" )) {
28602874 enc = get_conversion (SOAP_ENC_ARRAY );
28612875 } else {
28622876 enc = get_conversion (XSD_STRING );
@@ -3340,14 +3354,7 @@ xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval *data, int style, xmlNo
33403354static xmlNodePtr check_and_resolve_href (xmlNodePtr data )
33413355{
33423356 if (data && data -> properties ) {
3343- xmlAttrPtr href ;
3344-
3345- href = data -> properties ;
3346- while (1 ) {
3347- href = get_attribute (href , "href" );
3348- if (href == NULL || href -> ns == NULL ) {break ;}
3349- href = href -> next ;
3350- }
3357+ xmlAttrPtr href = get_attribute (data -> properties , "href" );
33513358 if (href ) {
33523359 /* Internal href try and find node */
33533360 if (href -> children -> content [0 ] == '#' ) {
0 commit comments