diff options
author | Dmitry Stogov <dmitry@php.net> | 2007-06-14 07:09:31 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2007-06-14 07:09:31 +0000 |
commit | 3b27cd22b62a126a13d1904ac744d677529f04d7 (patch) | |
tree | cf228fc589e0477da4ce3592496c902a9a81b7de | |
parent | ed39fac5d28c11be0f4818fba4db6b31b713eb4f (diff) | |
download | php-git-3b27cd22b62a126a13d1904ac744d677529f04d7.tar.gz |
Fixed bug #41566 (SOAP Server not properly generating href attributes)
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/soap/php_encoding.c | 8 | ||||
-rwxr-xr-x | ext/soap/tests/bugs/bug41566.phpt | 65 |
3 files changed, 75 insertions, 0 deletions
@@ -45,6 +45,8 @@ PHP NEWS other SAPIs disabling options). (Jani) - Fixed bug #41567 (json_encode() double conversion is inconsistent with PHP). (Lucas, Ilia) +- Fixed bug #41566 (SOAP Server not properly generating href attributes). + (Dmitry) - Fixed bug #41561 (Values set with php_admin_* in httpd.conf can be overwritten with ini_set()). (Tony, Dmitry) - Fixed bug #41555 (configure failure: regression caused by fix for #41265). diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 6a2c71d583..14b05e0210 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -297,6 +297,10 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) { } if (attr) { id = (char*)attr->children->content; + smart_str_appendc(&prefix, '#'); + smart_str_appends(&prefix, id); + smart_str_0(&prefix); + id = prefix.c; } else { SOAP_GLOBAL(cur_uniq_ref)++; smart_str_appendl(&prefix, "#ref", 4); @@ -310,6 +314,10 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) { attr = get_attribute_ex(attr, "id", SOAP_1_2_ENC_NAMESPACE); if (attr) { id = (char*)attr->children->content; + smart_str_appendc(&prefix, '#'); + smart_str_appends(&prefix, id); + smart_str_0(&prefix); + id = prefix.c; } else { SOAP_GLOBAL(cur_uniq_ref)++; smart_str_appendl(&prefix, "#ref", 4); diff --git a/ext/soap/tests/bugs/bug41566.phpt b/ext/soap/tests/bugs/bug41566.phpt new file mode 100755 index 0000000000..03ecdde043 --- /dev/null +++ b/ext/soap/tests/bugs/bug41566.phpt @@ -0,0 +1,65 @@ +--TEST-- +Bug #41566 (SOAP Server not properly generating href attributes) +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php +function test() { + $aUser = new User(); + $aUser->sName = 'newUser'; + + $aUsers = Array(); + $aUsers[] = $aUser; + $aUsers[] = $aUser; + $aUsers[] = $aUser; + $aUsers[] = $aUser; + return $aUsers; +} + +/* Simple User definition */ +Class User { + /** @var string */ + public $sName; +} + +$server = new soapserver(null,array('uri'=>"http://testuri.org", 'soap_version'=>SOAP_1_2)); +$server->addfunction("test"); + +$HTTP_RAW_POST_DATA = <<<EOF +<?xml version="1.0" encoding="ISO-8859-1"?> +<SOAP-ENV:Envelope + SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:si="http://soapinterop.org/xsd"> + <SOAP-ENV:Body> + <ns1:test xmlns:ns1="http://testuri.org" /> + </SOAP-ENV:Body> +</SOAP-ENV:Envelope> +EOF; +ob_start(); +$server->handle($HTTP_RAW_POST_DATA); +echo "ok\n"; + +$HTTP_RAW_POST_DATA = <<<EOF +<?xml version="1.0" encoding="UTF-8"?> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" + xmlns:ns1="http://testuri.org" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:enc="http://www.w3.org/2003/05/soap-encoding"> + <env:Body> + <ns1:test env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"/> + </env:Body> +</env:Envelope> +EOF; +$server->handle($HTTP_RAW_POST_DATA); +echo "ok\n"; +ob_flush(); +--EXPECT-- +<?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testuri.org" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:testResponse><return SOAP-ENC:arrayType="SOAP-ENC:Struct[4]" xsi:type="SOAP-ENC:Array"><item xsi:type="SOAP-ENC:Struct" id="ref1"><sName xsi:type="xsd:string">newUser</sName></item><item href="#ref1"/><item href="#ref1"/><item href="#ref1"/></return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> +ok +<?xml version="1.0" encoding="UTF-8"?> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://testuri.org" xmlns:enc="http://www.w3.org/2003/05/soap-encoding" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc"><ns1:testResponse env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"><rpc:result>return</rpc:result><return enc:itemType="enc:Struct" enc:arraySize="4" xsi:type="enc:Array"><item xsi:type="enc:Struct" enc:id="ref1"><sName xsi:type="xsd:string">newUser</sName></item><item enc:ref="#ref1"/><item enc:ref="#ref1"/><item enc:ref="#ref1"/></return></ns1:testResponse></env:Body></env:Envelope> +ok |