Browse Source
Fixed bug #36575 (SOAP: Incorrect complex type instantiation with hierarchies)
PHP-5.1
Fixed bug #36575 (SOAP: Incorrect complex type instantiation with hierarchies)
PHP-5.1
8 changed files with 223 additions and 38 deletions
-
2NEWS
-
71ext/soap/php_encoding.c
-
1ext/soap/soap.c
-
20ext/soap/tests/bugs/bug35142.phpt
-
26ext/soap/tests/bugs/bug36226.phpt
-
52ext/soap/tests/bugs/bug36575.phpt
-
87ext/soap/tests/bugs/bug36575.wsdl
-
2ext/soap/tests/classmap003.phpt
@ -0,0 +1,52 @@ |
|||
--TEST-- |
|||
Bug #36575 (Incorrect complex type instantiation with hierarchies) |
|||
--SKIPIF-- |
|||
<?php require_once('skipif.inc'); ?> |
|||
--INI-- |
|||
soap.wsdl_cache_enabled=0 |
|||
--FILE-- |
|||
<?php |
|||
abstract class CT_A1 { |
|||
public $var1; |
|||
} |
|||
|
|||
class CT_A2 extends CT_A1 { |
|||
public $var2; |
|||
} |
|||
|
|||
class CT_A3 extends CT_A2 { |
|||
public $var3; |
|||
} |
|||
|
|||
// returns A2 in WSDL |
|||
function test( $a1 ) { |
|||
$a3 = new CT_A3(); |
|||
$a3->var1 = $a1->var1; |
|||
$a3->var2 = "var two"; |
|||
$a3->var3 = "var three"; |
|||
return $a3; |
|||
} |
|||
|
|||
$classMap = array("A1" => "CT_A1", "A2" => "CT_A2", "A3" => "CT_A3"); |
|||
|
|||
$client = new SoapClient(dirname(__FILE__)."/bug36575.wsdl", array("trace" => 1, "exceptions" => 0, "classmap" => $classMap)); |
|||
$a2 = new CT_A2(); |
|||
$a2->var1 = "one"; |
|||
$a2->var2 = "two"; |
|||
$client->test($a2); |
|||
|
|||
$soapRequest = $client->__getLastRequest(); |
|||
|
|||
echo $soapRequest; |
|||
|
|||
$server = new SoapServer(dirname(__FILE__)."/bug36575.wsdl", array("classmap" => $classMap)); |
|||
$server->addFunction("test"); |
|||
$server->handle($soapRequest); |
|||
echo "ok\n"; |
|||
?> |
|||
--EXPECT-- |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:test.soap#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="urn:test.soap.types#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:test><a1 xsi:type="ns2:A2"><var1 xsi:type="xsd:string">one</var1><var2 xsi:type="xsd:string">two</var2></a1></ns1:test></SOAP-ENV:Body></SOAP-ENV:Envelope> |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:test.soap#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="urn:test.soap.types#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:testResponse><result xsi:type="ns2:A3"><var1 xsi:type="xsd:string">one</var1><var2 xsi:type="xsd:string">var two</var2><var3 xsi:type="xsd:string">var three</var3></result></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> |
|||
ok |
|||
@ -0,0 +1,87 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<definitions name="shoppingcart" |
|||
xmlns="http://schemas.xmlsoap.org/wsdl/" |
|||
xmlns:tns="urn:test.soap#" targetNamespace="urn:test.soap#" |
|||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" |
|||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" |
|||
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" |
|||
xmlns:xs="http://www.w3.org/2001/XMLSchema" |
|||
xmlns:types="urn:test.soap.types#"> |
|||
<!-- all datatypes will be imported to namespace types: --> |
|||
<types> |
|||
<xs:schema |
|||
xmlns:xs="http://www.w3.org/2001/XMLSchema" |
|||
xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap/" |
|||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" |
|||
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" |
|||
xmlns:tns="urn:test.soap.types#" |
|||
targetNamespace="urn:test.soap.types#"> |
|||
|
|||
<xs:complexType name="A1"> |
|||
<xs:all> |
|||
<xs:element name="var1" type="xs:string" nillable="true"/> |
|||
</xs:all> |
|||
</xs:complexType> |
|||
|
|||
<xs:complexType name="A2"> |
|||
<xs:complexContent> |
|||
<xs:extension base="tns:A1"> |
|||
<xs:all> |
|||
<xs:element name="var2" type="xs:string" nillable="true"/> |
|||
</xs:all> |
|||
</xs:extension> |
|||
</xs:complexContent> |
|||
</xs:complexType> |
|||
|
|||
<xs:complexType name="A3"> |
|||
<xs:complexContent> |
|||
<xs:extension base="tns:A2"> |
|||
<xs:all> |
|||
<xs:element name="var3" type="xs:string" nillable="true"/> |
|||
</xs:all> |
|||
</xs:extension> |
|||
</xs:complexContent> |
|||
</xs:complexType> |
|||
</xs:schema> |
|||
</types> |
|||
|
|||
<message name="test-request"> |
|||
<part name="a1" type="types:A1"/> |
|||
</message> |
|||
<message name="test-response"> |
|||
<part name="result" type="types:A2"/> |
|||
</message> |
|||
|
|||
<portType name="catalog-porttype"> |
|||
<operation name="test" parameterOrder="a1"> |
|||
<input name="test-request" message="tns:test-request"/> |
|||
<output name="test-response" message="tns:test-response"/> |
|||
</operation> |
|||
</portType> |
|||
|
|||
<!-- @type doesn't like tns: --> |
|||
<binding name="catalog-binding" type="tns:catalog-porttype"> |
|||
<soap:binding style="rpc" |
|||
transport="http://schemas.xmlsoap.org/soap/http"/> |
|||
|
|||
<operation name="test"> |
|||
<soap:operation soapAction="urn:test.soap#test"/> |
|||
<input> |
|||
<soap:body use="encoded" namespace="urn:test.soap#" |
|||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> |
|||
</input> |
|||
<output> |
|||
<soap:body use="encoded" namespace="urn:test.soap#" |
|||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> |
|||
</output> |
|||
</operation> |
|||
</binding> |
|||
|
|||
<service name="catalog"> |
|||
<!-- @binding doesn't like to be tns: --> |
|||
<port name="catalog-port" binding="tns:catalog-binding"> |
|||
<soap:address location="xxxxxxxx"/> |
|||
</port> |
|||
</service> |
|||
|
|||
</definitions> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue