From: Keith Smiley Date: Mon, 27 Jun 2016 18:23:15 +0000 (-0400) Subject: Fixed bug #73237 X-Git-Tag: php-7.1.0RC4~21^2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26287132c0c48e52dbaf1ac44c1d2f0d0d9b0cf7;p=php Fixed bug #73237 If the response includes both fields with simple types (which get concatenated into an XML string) and a complex type (which is parsed into an object), then the object will parsed into the same zval as the simple types and will overwrite the string. --- diff --git a/NEWS b/NEWS index 2b03b3131c..01d9fe2e30 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,8 @@ PHP NEWS - SOAP: . Fixed bug #73037 (SoapServer reports Bad Request when gzipped). (Anatol) + . Fixed bug #73237 (Nested object in "any" element overwrites other fields). + (Keith Smiley) - Standard: . Fixed bug #73203 (passing additional_parameters causes mail to fail). (cmb) diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 10d59ad576..7947b4cea3 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -1230,7 +1230,7 @@ static void unset_zval_property(zval* object, char* name) static void model_to_zval_any(zval *ret, xmlNodePtr node) { - zval rv, arr, val; + zval rv, arr, val, keepVal; zval* any = NULL; char* name = NULL; @@ -1259,6 +1259,7 @@ static void model_to_zval_any(zval *ret, xmlNodePtr node) ZVAL_NULL(&val2); master_to_zval(&val2, get_conversion(XSD_ANYXML), node->next); if (Z_TYPE(val2) != IS_STRING || *Z_STRVAL(val) != '<') { + Z_TRY_DELREF(val2); break; } concat_function(&val, &val, &val2); @@ -1277,7 +1278,8 @@ static void model_to_zval_any(zval *ret, xmlNodePtr node) any = &arr; name = NULL; } else { - any = &val; + ZVAL_COPY_VALUE(&keepVal, &val); + any = &keepVal; } } else { /* Add array element */ diff --git a/ext/soap/tests/bugs/bug73237.phpt b/ext/soap/tests/bugs/bug73237.phpt new file mode 100644 index 0000000000..e97345fdaa --- /dev/null +++ b/ext/soap/tests/bugs/bug73237.phpt @@ -0,0 +1,65 @@ +--TEST-- +Bug #73237 "Any" data missing when result includes a struct +--SKIPIF-- + +--INI-- +soap.wsdl_cache_enabled=0 +--FILE-- +trueCampaignMember00vi0000011VMgeAAG00vi0000011VMgeAAG701i0000001lreeAAASent00Qi000001UrbYFEAZLeadangela.lansbury@cbs.com1 +EOF; + } +} +$client = new LocalSoapClient(dirname(__FILE__)."/bug73237.wsdl"); +var_dump($client->query("")); +?> +--EXPECT-- +object(stdClass)#2 (1) { + ["result"]=> + object(stdClass)#3 (4) { + ["done"]=> + string(4) "true" + ["queryLocator"]=> + NULL + ["records"]=> + object(SoapVar)#6 (4) { + ["enc_type"]=> + int(0) + ["enc_value"]=> + object(stdClass)#4 (3) { + ["type"]=> + string(14) "CampaignMember" + ["Id"]=> + array(2) { + [0]=> + string(18) "00vi0000011VMgeAAG" + [1]=> + string(18) "00vi0000011VMgeAAG" + } + ["any"]=> + array(2) { + [0]=> + string(175) "701i0000001lreeAAASent00Qi000001UrbYFEAZ" + ["Lead"]=> + object(stdClass)#5 (3) { + ["type"]=> + string(4) "Lead" + ["Id"]=> + NULL + ["any"]=> + string(44) "angela.lansbury@cbs.com" + } + } + } + ["enc_stype"]=> + string(13) "genericObject" + ["enc_ns"]=> + string(27) "urn:object.test.example.org" + } + ["size"]=> + string(1) "1" + } +} diff --git a/ext/soap/tests/bugs/bug73237.wsdl b/ext/soap/tests/bugs/bug73237.wsdl new file mode 100644 index 0000000000..230338c285 --- /dev/null +++ b/ext/soap/tests/bugs/bug73237.wsdl @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create a Query Cursor + + + + + + + + + + + + + + + + + + + + + + + +