dmitry Mon Jul 10 07:41:33 2006 UTC Added files: (Branch: PHP_5_2) /php-src/ext/soap/tests/bugs bug38005.phpt
Modified files: /php-src NEWS /php-src/ext/soap php_packet_soap.c soap.c Log: Fixed bug #38005 (SoapFault faultstring doesn't follow encoding rules) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.112&r2=1.2027.2.547.2.113&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.112 php-src/NEWS:1.2027.2.547.2.113 --- php-src/NEWS:1.2027.2.547.2.112 Mon Jul 10 07:21:41 2006 +++ php-src/NEWS Mon Jul 10 07:41:32 2006 @@ -82,7 +82,9 @@ - Fixed memory leaks in openssl streams context options. (Pierre) - Fixed handling of extremely long paths inside tempnam() function. (Ilia) -- Fixed bug #38004 Parameters in SoapServer are decoded twice. (Dmitry) +- Fixed bug #38005 (SoapFault faultstring doesn't follow encoding rules). + (Dmitry) +- Fixed bug #38004 (Parameters in SoapServer are decoded twice). (Dmitry) - Fixed bug #38003 (in classes inherited from MySQLi it's possible to call private constructors from invalid context). (Tony) - Fixed bug #37987 (invalid return of file_exists() in safe mode). (Ilia) http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_packet_soap.c?r1=1.42.2.1&r2=1.42.2.1.2.1&diff_format=u Index: php-src/ext/soap/php_packet_soap.c diff -u php-src/ext/soap/php_packet_soap.c:1.42.2.1 php-src/ext/soap/php_packet_soap.c:1.42.2.1.2.1 --- php-src/ext/soap/php_packet_soap.c:1.42.2.1 Sun Jan 1 12:50:13 2006 +++ php-src/ext/soap/php_packet_soap.c Mon Jul 10 07:41:32 2006 @@ -17,7 +17,7 @@ | Dmitry Stogov <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: php_packet_soap.c,v 1.42.2.1 2006/01/01 12:50:13 sniper Exp $ */ +/* $Id: php_packet_soap.c,v 1.42.2.1.2.1 2006/07/10 07:41:32 dmitry Exp $ */ #include "php_soap.h" @@ -191,12 +191,16 @@ tmp = get_node(fault->children,"faultstring"); if (tmp != NULL && tmp->children != NULL) { - faultstring = tmp->children->content; + zval *zv = master_to_zval(get_conversion(IS_STRING), tmp); + faultstring = Z_STRVAL_P(zv); + FREE_ZVAL(zv); } tmp = get_node(fault->children,"faultactor"); if (tmp != NULL && tmp->children != NULL) { - faultactor = tmp->children->content; + zval *zv = master_to_zval(get_conversion(IS_STRING), tmp); + faultactor = Z_STRVAL_P(zv); + FREE_ZVAL(zv); } tmp = get_node(fault->children,"detail"); @@ -217,7 +221,9 @@ /* TODO: lang attribute */ tmp = get_node(tmp->children,"Text"); if (tmp != NULL && tmp->children != NULL) { - faultstring = tmp->children->content; + zval *zv = master_to_zval(get_conversion(IS_STRING), tmp); + faultstring = Z_STRVAL_P(zv); + FREE_ZVAL(zv); } } @@ -227,6 +233,12 @@ } } add_soap_fault(this_ptr, faultcode, faultstring, faultactor, details TSRMLS_CC); + if (faultstring) { + efree(faultstring); + } + if (faultactor) { + efree(faultactor); + } #ifdef ZEND_ENGINE_2 if (details) { details->refcount--; http://cvs.php.net/viewvc.cgi/php-src/ext/soap/soap.c?r1=1.156.2.28.2.3&r2=1.156.2.28.2.4&diff_format=u Index: php-src/ext/soap/soap.c diff -u php-src/ext/soap/soap.c:1.156.2.28.2.3 php-src/ext/soap/soap.c:1.156.2.28.2.4 --- php-src/ext/soap/soap.c:1.156.2.28.2.3 Fri May 26 09:02:33 2006 +++ php-src/ext/soap/soap.c Mon Jul 10 07:41:33 2006 @@ -17,7 +17,7 @@ | Dmitry Stogov <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: soap.c,v 1.156.2.28.2.3 2006/05/26 09:02:33 dmitry Exp $ */ +/* $Id: soap.c,v 1.156.2.28.2.4 2006/07/10 07:41:33 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3729,20 +3729,12 @@ efree(str); } if (zend_hash_find(prop, "faultstring", sizeof("faultstring"), (void**)&tmp) == SUCCESS) { - int new_len; - xmlNodePtr node = xmlNewNode(NULL, "faultstring"); - char *str = php_escape_html_entities(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &new_len, 0, 0, NULL TSRMLS_CC); - xmlAddChild(param, node); - xmlNodeSetContentLen(node, str, new_len); - efree(str); + xmlNodePtr node = master_to_xml(get_conversion(IS_STRING), *tmp, SOAP_LITERAL, param); + xmlNodeSetName(node, "faultstring"); } if (zend_hash_find(prop, "faultactor", sizeof("faultactor"), (void**)&tmp) == SUCCESS) { - int new_len; - xmlNodePtr node = xmlNewNode(NULL, "faultactor"); - char *str = php_escape_html_entities(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &new_len, 0, 0, NULL TSRMLS_CC); - xmlAddChild(param, node); - xmlNodeSetContentLen(node, str, new_len); - efree(str); + xmlNodePtr node = master_to_xml(get_conversion(IS_STRING), *tmp, SOAP_LITERAL, param); + xmlNodeSetName(node, "faultactor"); } detail_name = "detail"; } else { @@ -3760,12 +3752,10 @@ efree(str); } if (zend_hash_find(prop, "faultstring", sizeof("faultstring"), (void**)&tmp) == SUCCESS) { - int new_len; xmlNodePtr node = xmlNewChild(param, ns, "Reason", NULL); - char *str = php_escape_html_entities(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &new_len, 0, 0, NULL TSRMLS_CC); - node = xmlNewChild(node, ns, "Text", NULL); - xmlNodeSetContentLen(node, str, new_len); - efree(str); + node = master_to_xml(get_conversion(IS_STRING), *tmp, SOAP_LITERAL, node); + xmlNodeSetName(node, "Text"); + xmlSetNs(node, ns); } detail_name = SOAP_1_2_ENV_NS_PREFIX":Detail"; } http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug38005.phpt?view=markup&rev=1.1 Index: php-src/ext/soap/tests/bugs/bug38005.phpt +++ php-src/ext/soap/tests/bugs/bug38005.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php