From c389a653f734ec2f0517c25e324740b1606febfe Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 10 Jul 2006 07:21:41 +0000 Subject: [PATCH] Fixed bug #38004 Parameters in SoapServer are decoded twice --- NEWS | 1 + ext/soap/php_encoding.c | 5 +-- ext/soap/tests/bugs/bug38004.phpt | 40 ++++++++++++++++++++++++ ext/soap/tests/bugs/bug38004.wsdl | 51 +++++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 2 deletions(-) create mode 100755 ext/soap/tests/bugs/bug38004.phpt create mode 100755 ext/soap/tests/bugs/bug38004.wsdl diff --git a/NEWS b/NEWS index 0dee09c07c..d48ed47008 100644 --- a/NEWS +++ b/NEWS @@ -82,6 +82,7 @@ PHP NEWS - 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 #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) diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index a46a62ccf2..8d574c2225 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -1353,11 +1353,12 @@ static zval *to_zval_object_ex(encodeTypePtr type, xmlNodePtr data, zend_class_e str_val = (*attr)->def; } if (str_val) { + zval zstr; xmlNodePtr dummy; zval *data; - dummy = xmlNewNode(NULL, "BOGUS"); - xmlNodeSetContent(dummy, str_val); + ZVAL_STRING(&zstr, str_val, 0); + dummy = master_to_xml(get_conversion(IS_STRING), &zstr, SOAP_LITERAL, NULL); data = master_to_zval((*attr)->encode, dummy); xmlFreeNode(dummy); set_zval_property(ret, (*attr)->name, data TSRMLS_CC); diff --git a/ext/soap/tests/bugs/bug38004.phpt b/ext/soap/tests/bugs/bug38004.phpt new file mode 100755 index 0000000000..d187de3076 --- /dev/null +++ b/ext/soap/tests/bugs/bug38004.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #37278 (SOAP not respecting uri in __soapCall) +--SKIPIF-- + +--FILE-- +strA."\n".$param->strB."\n"; + return $g; +} + +class TestSoapClient extends SoapClient { + function __construct($wsdl) { + parent::__construct($wsdl); + $this->server = new SoapServer($wsdl); + $this->server->addFunction('Test'); + } + + function __doRequest($request, $location, $action, $version) { + ob_start(); + $this->server->handle($request); + $response = ob_get_contents(); + ob_end_clean(); + return $response; + } +} + +$client = new TestSoapClient(dirname(__FILE__).'/bug38004.wsdl'); +$strA = 'test & test'; +$strB = 'test & test'; +$res = $client->Test(array('strA'=>$strA, 'strB'=>$strB)); +print_r($res); +print_r($g); +?> +--EXPECT-- +test & test +test & test +test & test +test & test diff --git a/ext/soap/tests/bugs/bug38004.wsdl b/ext/soap/tests/bugs/bug38004.wsdl new file mode 100755 index 0000000000..c288135966 --- /dev/null +++ b/ext/soap/tests/bugs/bug38004.wsdl @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.50.1