From: Dmitry Stogov Date: Thu, 27 Nov 2008 14:49:46 +0000 (+0000) Subject: Fixed bug #44882 (SOAP extension object decoding bug) X-Git-Tag: php-5.2.7RC5~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac0fc54ec46269f6b74ef4fe4178cf4db752a421;p=php Fixed bug #44882 (SOAP extension object decoding bug) --- diff --git a/NEWS b/NEWS index 53f5b2a677..8a80f6ecd6 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,7 @@ PHP NEWS (Ilia) - Fixed bug #46427 (SoapClient() stumbles over its "stream_context" parameter). (Dmitry, Herman Radtke) +- Fixed bug #44882 (SOAP extension object decoding bug). (Dmitry) - Fixed bug #44182 (extract($a, EXTR_REFS) can fail to split copy-on-write references). (robin_fernandes at uk dot ibm dot com) - Fixed bug #44181 (extract($a, EXTR_OVERWRITE|EXTR_REFS) can fail to create diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 656759e295..62155db39b 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -1419,7 +1419,7 @@ static zval *to_zval_object_ex(encodeTypePtr type, xmlNodePtr data, zend_class_e sdlPtr sdl; sdlTypePtr sdlType = type->sdl_type; zend_class_entry *ce = ZEND_STANDARD_CLASS_DEF_PTR; - zend_bool redo_any = 0; + zval *redo_any = NULL; TSRMLS_FETCH(); if (pce) { @@ -1491,10 +1491,7 @@ static zval *to_zval_object_ex(encodeTypePtr type, xmlNodePtr data, zend_class_e if (soap_check_xml_ref(&ret, data TSRMLS_CC)) { return ret; } - if (get_zval_property(ret, "any" TSRMLS_CC) != NULL) { - unset_zval_property(ret, "any" TSRMLS_CC); - redo_any = 1; - } + redo_any = get_zval_property(ret, "any" TSRMLS_CC); if (Z_TYPE_P(ret) == IS_OBJECT && ce != ZEND_STANDARD_CLASS_DEF_PTR) { zend_object *zobj = zend_objects_get_address(ret TSRMLS_CC); zobj->ce = ce; @@ -1520,10 +1517,17 @@ static zval *to_zval_object_ex(encodeTypePtr type, xmlNodePtr data, zend_class_e object_init_ex(ret, ce); } if (sdlType->model) { + if (redo_any) { + redo_any->refcount++; + unset_zval_property(ret, "any" TSRMLS_CC); + } model_to_zval_object(ret, sdlType->model, data, sdl TSRMLS_CC); - if (redo_any && get_zval_property(ret, "any" TSRMLS_CC) == NULL) { - model_to_zval_any(ret, data->children TSRMLS_CC); - } + if (redo_any) { + if (get_zval_property(ret, "any" TSRMLS_CC) == NULL) { + model_to_zval_any(ret, data->children TSRMLS_CC); + } + zval_ptr_dtor(&redo_any); + } } if (sdlType->attributes) { sdlAttributePtr *attr; diff --git a/ext/soap/tests/bugs/bug44882.phpt b/ext/soap/tests/bugs/bug44882.phpt new file mode 100644 index 0000000000..baad747844 --- /dev/null +++ b/ext/soap/tests/bugs/bug44882.phpt @@ -0,0 +1,64 @@ +--TEST-- +Bug #44882 (SOAP extension object decoding bug) +--SKIPIF-- + +--INI-- +soap.wsdl_cache_enabled=0 +--FILE-- + + + + + 2008-06-23T14:51:08Z + Success + ae013a0ccdf13 + 50.000000 + 588340 + + EC-11Y75137T2399952C + + example@example.com + MU82WA43YXM9C + verified + + + + + +XML; + } +} + +$client = new TestSoapClient(dirname(__FILE__).'/bug44882.wsdl'); +print_r($client->GetExpressCheckoutDetails()); +?> +--EXPECT-- +stdClass Object +( + [Timestamp] => 2008-06-23T14:51:08Z + [Ack] => Success + [CorrelationID] => ae013a0ccdf13 + [Version] => 50.000000 + [Build] => 588340 + [GetExpressCheckoutDetailsResponseDetails] => stdClass Object + ( + [Token] => EC-11Y75137T2399952C + [PayerInfo] => stdClass Object + ( + [Payer] => example@example.com + [PayerID] => MU82WA43YXM9C + [PayerStatus] => verified + ) + + ) + +) diff --git a/ext/soap/tests/bugs/bug44882.wsdl b/ext/soap/tests/bugs/bug44882.wsdl new file mode 100644 index 0000000000..266f6a05b4 --- /dev/null +++ b/ext/soap/tests/bugs/bug44882.wsdl @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +