dmitry Thu Nov 27 14:50:06 2008 UTC Modified files: /php-src/ext/soap php_encoding.c /php-src/ext/soap/tests/bugs bug44882.phpt bug44882.wsdl Log: Fixed bug #44882 (SOAP extension object decoding bug) http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_encoding.c?r1=1.172&r2=1.173&diff_format=u Index: php-src/ext/soap/php_encoding.c diff -u php-src/ext/soap/php_encoding.c:1.172 php-src/ext/soap/php_encoding.c:1.173 --- php-src/ext/soap/php_encoding.c:1.172 Sun Oct 26 01:58:25 2008 +++ php-src/ext/soap/php_encoding.c Thu Nov 27 14:50:06 2008 @@ -17,7 +17,7 @@ | Dmitry Stogov <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: php_encoding.c,v 1.172 2008/10/26 01:58:25 felipe Exp $ */ +/* $Id: php_encoding.c,v 1.173 2008/11/27 14:50:06 dmitry Exp $ */ #include <time.h> @@ -1388,7 +1388,7 @@ sdlPtr sdl; sdlTypePtr sdlType = type->sdl_type; zend_class_entry *ce; - zend_bool redo_any = 0; + zval *redo_any = NULL; TSRMLS_FETCH(); ce = ZEND_STANDARD_CLASS_DEF_PTR; @@ -1462,10 +1462,7 @@ 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; @@ -1491,10 +1488,17 @@ object_init_ex(ret, ce); } if (sdlType->model) { + if (redo_any) { + Z_ADDREF_P(redo_any); + 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; http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug44882.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/soap/tests/bugs/bug44882.phpt diff -u /dev/null php-src/ext/soap/tests/bugs/bug44882.phpt:1.2 --- /dev/null Thu Nov 27 14:50:06 2008 +++ php-src/ext/soap/tests/bugs/bug44882.phpt Thu Nov 27 14:50:06 2008 @@ -0,0 +1,64 @@ +--TEST-- +Bug #44882 (SOAP extension object decoding bug) +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--INI-- +soap.wsdl_cache_enabled=0 +--FILE-- +<?php +class TestSoapClient extends SoapClient +{ + public function __doRequest($req, $loc, $act, $ver, $oneway=0) + { + return <<<XML +<?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope + xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ns="urn:ebay:api:PayPalAPI"> + <SOAP-ENV:Body id="_0"> + <GetExpressCheckoutDetailsResponse xmlns="urn:ebay:api:PayPalAPI"> + <Timestamp>2008-06-23T14:51:08Z</Timestamp> + <Ack>Success</Ack> + <CorrelationID>ae013a0ccdf13</CorrelationID> + <Version>50.000000</Version> + <Build>588340</Build> + <GetExpressCheckoutDetailsResponseDetails xsi:type="ns:GetExpressCheckoutDetailsResponseDetailsType"> + <Token>EC-11Y75137T2399952C</Token> + <PayerInfo> + <Payer>[EMAIL PROTECTED]</Payer> + <PayerID>MU82WA43YXM9C</PayerID> + <PayerStatus>verified</PayerStatus> + </PayerInfo> + </GetExpressCheckoutDetailsResponseDetails> + </GetExpressCheckoutDetailsResponse> + </SOAP-ENV:Body> +</SOAP-ENV:Envelope> +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] => [EMAIL PROTECTED] + [PayerID] => MU82WA43YXM9C + [PayerStatus] => verified + ) + + ) + +) http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug44882.wsdl?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/soap/tests/bugs/bug44882.wsdl diff -u /dev/null php-src/ext/soap/tests/bugs/bug44882.wsdl:1.2 --- /dev/null Thu Nov 27 14:50:06 2008 +++ php-src/ext/soap/tests/bugs/bug44882.wsdl Thu Nov 27 14:50:06 2008 @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<wsdl:definitions + xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:ns="urn:ebay:api:PayPalAPI" + xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" + targetNamespace="urn:ebay:api:PayPalAPI"> + <wsdl:types> + <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:ebay:api:PayPalAPI" elementFormDefault="qualified" attributeFormDefault="unqualified"> + <complexType name="PayerInfoType"> + <sequence> + <element name="Payer" type="xs:string" minOccurs="0"/> + <element name="PayerID" type="xs:string" minOccurs="0"/> + <element name="PayerStatus" type="xs:string" minOccurs="0"/> + </sequence> + </complexType> + <complexType name="AbstractResponseType" abstract="true"> + <sequence> + <element name="Timestamp" type="xs:dateTime" minOccurs="0"/> + <element name="Ack" type="xs:string"/> + <element name="CorrelationID" type="xs:string" minOccurs="0"/> + <element name="Version" type="xs:string"/> + <element name="Build" type="xs:string"/> + <any processContents="lax" minOccurs="0"/> + </sequence> + </complexType> + <xs:element name="GetExpressCheckoutDetailsResponseDetails" type="ns:GetExpressCheckoutDetailsResponseDetailsType"/> + <xs:complexType name="GetExpressCheckoutDetailsResponseDetailsType"> + <xs:sequence> + <xs:element name="Token" type="xs:string"/> + <xs:element name="PayerInfo" type="ns:PayerInfoType"/> + </xs:sequence> + </xs:complexType> + <xs:element name="GetExpressCheckoutDetailsResponse" type="ns:GetExpressCheckoutDetailsResponseType"/> + <xs:complexType name="GetExpressCheckoutDetailsResponseType"> + <xs:complexContent> + <xs:extension base="ns:AbstractResponseType"> + <xs:sequence> + <xs:element ref="ns:GetExpressCheckoutDetailsResponseDetails" minOccurs="1" maxOccurs="1"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </schema> + </wsdl:types> + <wsdl:message name="GetExpressCheckoutDetailsRequest"> + </wsdl:message> + <wsdl:message name="GetExpressCheckoutDetailsResponse"> + <wsdl:part name="GetExpressCheckoutDetailsResponse" element="ns:GetExpressCheckoutDetailsResponse"/> + </wsdl:message> + <wsdl:portType name="PayPalAPIAAInterface"> + <wsdl:operation name="GetExpressCheckoutDetails"> + <wsdl:input message="ns:GetExpressCheckoutDetailsRequest"/> + <wsdl:output message="ns:GetExpressCheckoutDetailsResponse"/> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="PayPalAPIAASoapBinding" type="ns:PayPalAPIAAInterface"> + <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + <wsdl:operation name="GetExpressCheckoutDetails"> + <wsdlsoap:operation/> + <wsdl:input> + <wsdlsoap:body use="literal"/> + </wsdl:input> + <wsdl:output> + <wsdlsoap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="PayPalAPIInterfaceService"> + <wsdl:port name="PayPalAPIAA" binding="ns:PayPalAPIAASoapBinding"> + <wsdlsoap:address location="test://"/> + </wsdl:port> + </wsdl:service> +</wsdl:definitions>
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php