@@ -87,28 +87,6 @@ static zend_always_inline const char *soap_type_name(encodeTypePtr type)
8787 return (type && type -> type_str ) ? type -> type_str : "unknown" ;
8888}
8989
90- static zend_always_inline void soap_encoding_error_invalid_node (encodeTypePtr type )
91- {
92- soap_error1 (E_ERROR , "Encoding: Type '%s' value must contain a single text or CDATA node" , soap_type_name (type ));
93- }
94-
95- static zend_always_inline void soap_encoding_error_invalid_value (encodeTypePtr type )
96- {
97- soap_error1 (E_ERROR , "Encoding: Invalid value for type '%s'" , soap_type_name (type ));
98- }
99-
100- static zend_always_inline void soap_encoding_error_invalid_hex_length (encodeTypePtr type )
101- {
102- soap_error1 (E_ERROR , "Encoding: Type '%s' value must contain an even number of hexadecimal digits" , soap_type_name (type ));
103- }
104-
105- static zend_always_inline void soap_encoding_error_invalid_list_item (encodeTypePtr type , encodeTypePtr item_type )
106- {
107- soap_error2 (E_ERROR ,
108- "Encoding: Failed to encode list item of type '%s' for list type '%s'" ,
109- soap_type_name (item_type ), soap_type_name (type ));
110- }
111-
11290static encodePtr get_array_type (xmlNodePtr node , zval * array , smart_str * out_type );
11391
11492static xmlNodePtr check_and_resolve_href (xmlNodePtr data );
@@ -687,7 +665,7 @@ static zval *to_zval_string(zval *ret, encodeTypePtr type, xmlNodePtr data)
687665 } else if (data -> children -> type == XML_CDATA_SECTION_NODE && data -> children -> next == NULL ) {
688666 ZVAL_STRING (ret , (char * )data -> children -> content );
689667 } else {
690- soap_encoding_error_invalid_node ( type );
668+ soap_error1 ( E_ERROR , "Encoding: Type '%s' value must contain a single text or CDATA node" , soap_type_name ( type ) );
691669 }
692670 } else {
693671 ZVAL_EMPTY_STRING (ret );
@@ -720,7 +698,7 @@ static zval *to_zval_stringr(zval *ret, encodeTypePtr type, xmlNodePtr data)
720698 } else if (data -> children -> type == XML_CDATA_SECTION_NODE && data -> children -> next == NULL ) {
721699 ZVAL_STRING (ret , (char * )data -> children -> content );
722700 } else {
723- soap_encoding_error_invalid_node ( type );
701+ soap_error1 ( E_ERROR , "Encoding: Type '%s' value must contain a single text or CDATA node" , soap_type_name ( type ) );
724702 }
725703 } else {
726704 ZVAL_EMPTY_STRING (ret );
@@ -753,7 +731,7 @@ static zval *to_zval_stringc(zval *ret, encodeTypePtr type, xmlNodePtr data)
753731 } else if (data -> children -> type == XML_CDATA_SECTION_NODE && data -> children -> next == NULL ) {
754732 ZVAL_STRING (ret , (char * )data -> children -> content );
755733 } else {
756- soap_encoding_error_invalid_node ( type );
734+ soap_error1 ( E_ERROR , "Encoding: Type '%s' value must contain a single text or CDATA node" , soap_type_name ( type ) );
757735 }
758736 } else {
759737 ZVAL_EMPTY_STRING (ret );
@@ -772,17 +750,17 @@ static zval *to_zval_base64(zval *ret, encodeTypePtr type, xmlNodePtr data)
772750 whiteSpace_collapse (data -> children -> content );
773751 str = php_base64_decode (data -> children -> content , strlen ((char * )data -> children -> content ));
774752 if (!str ) {
775- soap_encoding_error_invalid_value ( type );
753+ soap_error1 ( E_ERROR , "Encoding: Invalid value for type '%s'" , soap_type_name ( type ) );
776754 }
777755 ZVAL_STR (ret , str );
778756 } else if (data -> children -> type == XML_CDATA_SECTION_NODE && data -> children -> next == NULL ) {
779757 str = php_base64_decode (data -> children -> content , strlen ((char * )data -> children -> content ));
780758 if (!str ) {
781- soap_encoding_error_invalid_value ( type );
759+ soap_error1 ( E_ERROR , "Encoding: Invalid value for type '%s'" , soap_type_name ( type ) );
782760 }
783761 ZVAL_STR (ret , str );
784762 } else {
785- soap_encoding_error_invalid_node ( type );
763+ soap_error1 ( E_ERROR , "Encoding: Type '%s' value must contain a single text or CDATA node" , soap_type_name ( type ) );
786764 }
787765 } else {
788766 ZVAL_EMPTY_STRING (ret );
@@ -803,12 +781,12 @@ static zval *to_zval_hexbin(zval *ret, encodeTypePtr type, xmlNodePtr data)
803781 if (data -> children -> type == XML_TEXT_NODE && data -> children -> next == NULL ) {
804782 whiteSpace_collapse (data -> children -> content );
805783 } else if (data -> children -> type != XML_CDATA_SECTION_NODE || data -> children -> next != NULL ) {
806- soap_encoding_error_invalid_node ( type );
784+ soap_error1 ( E_ERROR , "Encoding: Type '%s' value must contain a single text or CDATA node" , soap_type_name ( type ) );
807785 return ret ;
808786 }
809787 content_len = strlen ((char * ) data -> children -> content );
810788 if (content_len % 2 != 0 ) {
811- soap_encoding_error_invalid_hex_length ( type );
789+ soap_error1 ( E_ERROR , "Encoding: Type '%s' value must contain an even number of hexadecimal digits" , soap_type_name ( type ) );
812790 return ret ;
813791 }
814792 str = zend_string_alloc (content_len / 2 , 0 );
@@ -821,7 +799,7 @@ static zval *to_zval_hexbin(zval *ret, encodeTypePtr type, xmlNodePtr data)
821799 } else if (c >= 'A' && c <= 'F' ) {
822800 ZSTR_VAL (str )[i ] = (c - 'A' + 10 ) << 4 ;
823801 } else {
824- soap_encoding_error_invalid_value ( type );
802+ soap_error1 ( E_ERROR , "Encoding: Invalid value for type '%s'" , soap_type_name ( type ) );
825803 }
826804 c = data -> children -> content [j ++ ];
827805 if (c >= '0' && c <= '9' ) {
@@ -831,7 +809,7 @@ static zval *to_zval_hexbin(zval *ret, encodeTypePtr type, xmlNodePtr data)
831809 } else if (c >= 'A' && c <= 'F' ) {
832810 ZSTR_VAL (str )[i ] |= c - 'A' + 10 ;
833811 } else {
834- soap_encoding_error_invalid_value ( type );
812+ soap_error1 ( E_ERROR , "Encoding: Invalid value for type '%s'" , soap_type_name ( type ) );
835813 }
836814 }
837815 ZSTR_VAL (str )[ZSTR_LEN (str )] = '\0' ;
@@ -1052,11 +1030,11 @@ static zval *to_zval_double(zval *ret, encodeTypePtr type, xmlNodePtr data)
10521030 } else if (strncasecmp ((char * )data -> children -> content , "-INF" , sizeof ("-INF" )- 1 ) == 0 ) {
10531031 ZVAL_DOUBLE (ret , - php_get_inf ());
10541032 } else {
1055- soap_encoding_error_invalid_value ( type );
1033+ soap_error1 ( E_ERROR , "Encoding: Invalid value for type '%s'" , soap_type_name ( type ) );
10561034 }
10571035 }
10581036 } else {
1059- soap_encoding_error_invalid_node ( type );
1037+ soap_error1 ( E_ERROR , "Encoding: Type '%s' value must contain a single text or CDATA node" , soap_type_name ( type ) );
10601038 }
10611039 } else {
10621040 ZVAL_NULL (ret );
@@ -1085,10 +1063,10 @@ static zval *to_zval_long(zval *ret, encodeTypePtr type, xmlNodePtr data)
10851063 ZVAL_DOUBLE (ret , dval );
10861064 break ;
10871065 default :
1088- soap_encoding_error_invalid_value ( type );
1066+ soap_error1 ( E_ERROR , "Encoding: Invalid value for type '%s'" , soap_type_name ( type ) );
10891067 }
10901068 } else {
1091- soap_encoding_error_invalid_node ( type );
1069+ soap_error1 ( E_ERROR , "Encoding: Type '%s' value must contain a single text or CDATA node" , soap_type_name ( type ) );
10921070 }
10931071 } else {
10941072 ZVAL_NULL (ret );
@@ -1154,7 +1132,7 @@ static zval *to_zval_bool(zval *ret, encodeTypePtr type, xmlNodePtr data)
11541132 }
11551133 if (data -> children -> type != XML_TEXT_NODE || data -> children -> next != NULL ) {
11561134 // TODO Convert to exception?
1157- soap_encoding_error_invalid_node ( type );
1135+ soap_error1 ( E_ERROR , "Encoding: Type '%s' value must contain a single text or CDATA node" , soap_type_name ( type ) );
11581136 }
11591137
11601138 whiteSpace_collapse (data -> children -> content );
@@ -3123,7 +3101,9 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP
31233101 }
31243102 smart_str_appends (& list , (char * )dummy -> children -> content );
31253103 } else {
3126- soap_encoding_error_invalid_list_item (enc , & list_enc -> details );
3104+ soap_error2 (E_ERROR ,
3105+ "Encoding: Failed to encode list item of type '%s' for list type '%s'" ,
3106+ soap_type_name (& list_enc -> details ), soap_type_name (enc ));
31273107 }
31283108 xmlUnlinkNode (dummy );
31293109 xmlFreeNode (dummy );
@@ -3165,7 +3145,9 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP
31653145 }
31663146 smart_str_appends (& list , (char * )dummy -> children -> content );
31673147 } else {
3168- soap_encoding_error_invalid_list_item (enc , & list_enc -> details );
3148+ soap_error2 (E_ERROR ,
3149+ "Encoding: Failed to encode list item of type '%s' for list type '%s'" ,
3150+ soap_type_name (& list_enc -> details ), soap_type_name (enc ));
31693151 }
31703152 xmlUnlinkNode (dummy );
31713153 xmlFreeNode (dummy );
0 commit comments