From: Dmitry Stogov Date: Wed, 12 Jul 2006 08:59:40 +0000 (+0000) Subject: Fixed bug #38067 (Parameters are not decoded from utf-8 when using encoding option) X-Git-Tag: php-5.2.0RC1~120 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c48a2e38f419f16118eba9b82cc00fac5a29551d;p=php Fixed bug #38067 (Parameters are not decoded from utf-8 when using encoding option) --- diff --git a/NEWS b/NEWS index 93be7adf05..77676d0f43 100644 --- a/NEWS +++ b/NEWS @@ -82,6 +82,8 @@ PHP NEWS - Fixed memory leaks in openssl streams context options. (Pierre) - Fixed handling of extremely long paths inside tempnam() function. (Ilia) +- Fixed bug #38067 (Parameters are not decoded from utf-8 when using encoding + option). (Dmitry) - Fixed bug #38055 (Wrong interpretation of boolean parameters). (Dmitry) - Fixed bug #38019 (segfault extending mysqli class). (Dmitry) - Fixed bug #38005 (SoapFault faultstring doesn't follow encoding rules). diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index c95c1aaeb9..52f784897d 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -1346,12 +1346,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; + xmlNodePtr dummy, text; zval *data; - ZVAL_STRING(&zstr, str_val, 0); - dummy = master_to_xml(get_conversion(IS_STRING), &zstr, SOAP_LITERAL, NULL); + dummy = xmlNewNode(NULL, BAD_CAST("BOGUS")); + text = xmlNewText(BAD_CAST(str_val)); + xmlAddChild(dummy, text); 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/bug38067.phpt b/ext/soap/tests/bugs/bug38067.phpt new file mode 100755 index 0000000000..9c0cbb4fba --- /dev/null +++ b/ext/soap/tests/bugs/bug38067.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #38067 (Parameters are not decoded from utf-8 when using encoding option) +--SKIPIF-- + +--FILE-- +str; + return $g; +} + +class TestSoapClient extends SoapClient { + function __construct($wsdl, $opt) { + parent::__construct($wsdl, $opt); + $this->server = new SoapServer($wsdl, $opt); + $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__).'/bug38067.wsdl', + array('encoding' => 'ISO-8859-1')); +$str = 'test: Ä'; +$res = $client->Test(array('str'=>$str)); +echo $str."\n"; +echo $res."\n"; +echo $g."\n"; +?> +--EXPECT-- +test: Ä +test: Ä +test: Ä diff --git a/ext/soap/tests/bugs/bug38067.wsdl b/ext/soap/tests/bugs/bug38067.wsdl new file mode 100755 index 0000000000..beb9fc2141 --- /dev/null +++ b/ext/soap/tests/bugs/bug38067.wsdl @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +