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) {
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;
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;
--- /dev/null
+--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, $one_way = 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>example@example.com</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] => example@example.com
+ [PayerID] => MU82WA43YXM9C
+ [PayerStatus] => verified
+ )
+
+ )
+
+)
--- /dev/null
+<?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>