diff options
Diffstat (limited to 'ext/soap/tests/bugs')
| -rwxr-xr-x | ext/soap/tests/bugs/bug36226.phpt | 139 | ||||
| -rwxr-xr-x | ext/soap/tests/bugs/bug36575.phpt | 52 | ||||
| -rwxr-xr-x | ext/soap/tests/bugs/bug36575.wsdl | 87 | ||||
| -rwxr-xr-x | ext/soap/tests/bugs/bug36614.phpt | 13 | ||||
| -rwxr-xr-x | ext/soap/tests/bugs/bug36614.wsdl | 204 | ||||
| -rwxr-xr-x | ext/soap/tests/bugs/bug36629.phpt | 53 |
6 files changed, 548 insertions, 0 deletions
diff --git a/ext/soap/tests/bugs/bug36226.phpt b/ext/soap/tests/bugs/bug36226.phpt new file mode 100755 index 0000000000..c88d969f29 --- /dev/null +++ b/ext/soap/tests/bugs/bug36226.phpt @@ -0,0 +1,139 @@ +--TEST-- +Bug #36226 SOAP Inconsistent handling when passing potential arrays. +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--INI-- +soap.wsdl_cache_enabled=0 +--FILE-- +<?php +ini_set("soap.wsdl_cache_enabled",0); +$timestamp = "2005-11-08T11:22:07+03:00"; +$wsdl = dirname(__FILE__)."/bug35142.wsdl"; + +function PostEvents($x) { + var_dump($x); + exit(); + return $x; +} + +class TestSoapClient extends SoapClient { + + function __construct($wsdl, $options) { + parent::__construct($wsdl, $options); + $this->server = new SoapServer($wsdl, $options); + $this->server->addFunction('PostEvents'); + } + + function __doRequest($request, $location, $action, $version) { + echo "$request\n"; + $this->server->handle($request); + return $response; + } + +} + +$soapClient = new TestSoapClient($wsdl, + array('trace' => 1, 'exceptions' => 0, + 'classmap' => array('logOnEvent' => 'LogOnEvent', + 'logOffEvent' => 'LogOffEvent', + 'events' => 'IVREvents'), + 'features' => SOAP_SINGLE_ELEMENT_ARRAYS)); + +$logOnEvent = new LogOnEvent(34567, $timestamp); +$logOffEvents[] = new LogOffEvent(34567, $timestamp, "Smoked"); +$logOffEvents[] = new LogOffEvent(34568, $timestamp, "SmokeFree"); +$ivrEvents = new IVREvents("1.0", 101, 12345, 'IVR', $logOnEvent, $logOffEvents); + +$result = $soapClient->PostEvents($ivrEvents); + +class LogOffEvent { + public $audienceMemberId; + public $timestamp; + public $smokeStatus; + public $callInitiator; + + function __construct($audienceMemberId, $timestamp, $smokeStatus) { + $this->audienceMemberId = $audienceMemberId; + $this->timestamp = $timestamp; + $this->smokeStatus = $smokeStatus; + $this->callInitiator = "IVR"; + } +} + +class LogOnEvent { + public $audienceMemberId; + public $timestamp; + + function __construct($audienceMemberId, $timestamp) { + $this->audienceMemberId = $audienceMemberId; + $this->timestamp = $timestamp; + } +} + +class IVREvents { + public $version; + public $activityId; + public $messageId; + public $source; + public $logOnEvent; + public $logOffEvent; + + function __construct($version, $activityId, $messageId, $source, $logOnEvent=NULL, $logOffEvent=NULL) { + $this->version = $version; + $this->activityId = $activityId; + $this->messageId = $messageId; + $this->source = $source; + $this->logOnEvent = $logOnEvent; + $this->logOffEvent = $logOffEvent; + } +} +?> +--EXPECTF-- +<?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testurl/Message"><SOAP-ENV:Body><ns1:ivrEvents version="1.0" activityId="101" messageId="12345" source="IVR"><ns1:logOffEvent audienceMemberId="34567" timestamp="2005-11-08T11:22:07+03:00" smokeStatus="Smoked" callInitiator="IVR"/><ns1:logOffEvent audienceMemberId="34568" timestamp="2005-11-08T11:22:07+03:00" smokeStatus="SmokeFree" callInitiator="IVR"/><ns1:logOnEvent audienceMemberId="34567" timestamp="2005-11-08T11:22:07+03:00"/></ns1:ivrEvents></SOAP-ENV:Body></SOAP-ENV:Envelope> + +object(IVREvents)#%d (6) { + ["version"]=> + string(3) "1.0" + ["activityId"]=> + int(101) + ["messageId"]=> + int(12345) + ["source"]=> + string(3) "IVR" + ["logOnEvent"]=> + array(1) { + [0]=> + object(LogOnEvent)#10 (2) { + ["audienceMemberId"]=> + int(34567) + ["timestamp"]=> + string(25) "2005-11-08T11:22:07+03:00" + } + } + ["logOffEvent"]=> + array(2) { + [0]=> + object(LogOffEvent)#%d (4) { + ["audienceMemberId"]=> + int(34567) + ["timestamp"]=> + string(25) "2005-11-08T11:22:07+03:00" + ["smokeStatus"]=> + string(6) "Smoked" + ["callInitiator"]=> + string(3) "IVR" + } + [1]=> + object(LogOffEvent)#%d (4) { + ["audienceMemberId"]=> + int(34568) + ["timestamp"]=> + string(25) "2005-11-08T11:22:07+03:00" + ["smokeStatus"]=> + string(9) "SmokeFree" + ["callInitiator"]=> + string(3) "IVR" + } + } +} diff --git a/ext/soap/tests/bugs/bug36575.phpt b/ext/soap/tests/bugs/bug36575.phpt new file mode 100755 index 0000000000..aad8fcad6a --- /dev/null +++ b/ext/soap/tests/bugs/bug36575.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 diff --git a/ext/soap/tests/bugs/bug36575.wsdl b/ext/soap/tests/bugs/bug36575.wsdl new file mode 100755 index 0000000000..0f1899bcd5 --- /dev/null +++ b/ext/soap/tests/bugs/bug36575.wsdl @@ -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>
diff --git a/ext/soap/tests/bugs/bug36614.phpt b/ext/soap/tests/bugs/bug36614.phpt new file mode 100755 index 0000000000..ba6734812d --- /dev/null +++ b/ext/soap/tests/bugs/bug36614.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #36614 (Segfault when using Soap) +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--INI-- +soap.wsdl_cache_enabled=0 +--FILE-- +<?php +$lo_soap = new SoapClient(dirname(__FILE__)."/bug36614.wsdl"); +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/ext/soap/tests/bugs/bug36614.wsdl b/ext/soap/tests/bugs/bug36614.wsdl new file mode 100755 index 0000000000..ecf1b1b2fe --- /dev/null +++ b/ext/soap/tests/bugs/bug36614.wsdl @@ -0,0 +1,204 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<definitions name="SonicMobile Web-Services" + targetNamespace="http://soap.sonicmobile.com/sonicmobile.wsdl" + xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:sonic="http://soap.sonicmobile.com/sonicmobile.wsdl" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <types> + <xsd:schema xmlns="http://www.w3.org/2000/10/XMLSchema"> + <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> + <complexType name="TransportCount"> + <all> + <element name="transport" type="string" /> + <element name="count" type="integer" /> + <element name="rate" type="integer" /> + <element name="last_message" type="integer" /> + </all> + </complexType> + <complexType name="ArrayOfTransportCount"> + <complexContent> + <restriction base="soapenc:Array"> + <attribute ref="soapenc:arrayType" arrayType="TransportCount[]" /> + </restriction> + </complexContent> + </complexType> + </xsd:schema> + </types> + + <message name="userSendMessageRequest"> + <part name="sourceUser" type="xsd:int"/> + <part name="password" type="xsd:string"/> + <part name="destinationUser" type="xsd:int"/> + <part name="content" type="xsd:string"/> + <part name="sendRepliesTo" type="xsd:string"/> + <part name="reference" type="xsd:string"/> + </message> + + <message name="sendMessageRequest"> + <part name="application" type="xsd:string"/> + <part name="password" type="xsd:string"/> + <part name="destination" type="xsd:string"/> + <part name="content" type="xsd:string"/> + <part name="reference" type="xsd:string"/> + <part name="requestSource" type="xsd:string"/> + <part name="customer" type="xsd:string"/> + <part name="class" type="xsd:string"/> + </message> + + <message name="MessageResponse"> + <part name="messageid" type="xsd:int"/> + <part name="response" type="xsd:string"/> + </message> + + <message name="messageCountRequest"> + <part name="password" type="xsd:string"/> + </message> + + <message name="messageCountResponse"> + <part name="transports" type="tns:ArrayOfTransportCount"/> + </message> + + <message name="serverStatusRequest"> + <part name="password" type="xsd:string"/> + </message> + <message name="serverStatusResponse"> + <part name="status_string" type="xsd:string"/> + </message> + + <message name="flushGatewayRequest"> + <part name="password" type="xsd:string"/> + </message> + <message name="flushGatewayResponse"> + <part name="status_string" type="xsd:string"/> + </message> + + <portType name="SonicMobilePortType"> + <operation name="userSendMessage"> + <input message="sonic:userSendMessageRequest"/> + <output message="sonic:MessageResponse"/> + </operation> + + <operation name="sendMessage"> + <input message="sonic:sendMessageRequest"/> + <output message="sonic:MessageResponse"/> + </operation> + + <operation name="messageCount"> + <input message="sonic:messageCountRequest"/> + <output message="sonic:messageCountResponse"/> + </operation> + + <operation name="serverStatus"> + <input message="sonic:serverStatusRequest"/> + <output message="sonic:serverStatusResponse"/> + </operation> + + <operation name="flushGateway"> + <input message="sonic:flushGatewayRequest"/> + <output message="sonic:flushGatewayResponse"/> + </operation> + </portType> + + <binding name="SonicMobileBinding" type="sonic:SonicMobilePortType"> + <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> + + <operation name="userSendMessage"> + <soap:operation soapAction="http://soap.sonicmobile.com/SonicMobile/SOAP#userSendMessage"/> + + <input> + <soap:body + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + namespace="http://soap.sonicmobile.com/SonicMobile/SOAP" + use="encoded" /> + </input> + + <output> + <soap:body + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + namespace="http://soap.sonicmobile.com/SonicMobile/SOAP" + use="encoded" /> + </output> + </operation> + + <operation name="sendMessage"> + <soap:operation soapAction="http://soap.sonicmobile.com/SonicMobile/SOAP#sendMessage"/> + + <input> + <soap:body + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + namespace="http://soap.sonicmobile.com/SonicMobile/SOAP" + use="encoded" /> + </input> + + <output> + <soap:body + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + namespace="http://soap.sonicmobile.com/SonicMobile/SOAP" + use="encoded" /> + </output> + </operation> + + <operation name="messageCount"> + <soap:operation soapAction="http://soap.sonicmobile.com/SonicMobile/SOAP#messageCount"/> + + <input> + <soap:body + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + namespace="http://soap.sonicmobile.com/SonicMobile/SOAP" + use="encoded" /> + </input> + + <output> + <soap:body + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + namespace="http://soap.sonicmobile.com/SonicMobile/SOAP" + use="encoded" /> + </output> + </operation> + + <operation name="serverStatus"> + <soap:operation soapAction="http://soap.sonicmobile.com/SonicMobile/SOAP#serverStatus"/> + + <input> + <soap:body + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + namespace="http://soap.sonicmobile.com/SonicMobile/SOAP" + use="encoded" /> + </input> + + <output> + <soap:body + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + namespace="http://soap.sonicmobile.com/SonicMobile/SOAP" + use="encoded" /> + </output> + </operation> + + <operation name="flushGateway"> + <soap:operation soapAction="http://soap.sonicmobile.com/SonicMobile/SOAP#flushGateway"/> + + <input> + <soap:body + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + namespace="http://soap.sonicmobile.com/SonicMobile/SOAP" + use="encoded" /> + </input> + <output> + <soap:body + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + namespace="http://soap.sonicmobile.com/SonicMobile/SOAP" + use="encoded" /> + </output> + </operation> + + </binding> + + <service name="SonicMobile"> + <port name="SonicMobilePort" binding="sonic:SonicMobileBinding"> + <soap:address location="http://soap.sonicmobile.com/"/> + </port> + </service> + +</definitions> diff --git a/ext/soap/tests/bugs/bug36629.phpt b/ext/soap/tests/bugs/bug36629.phpt new file mode 100755 index 0000000000..08b74a5fca --- /dev/null +++ b/ext/soap/tests/bugs/bug36629.phpt @@ -0,0 +1,53 @@ +--TEST-- +Bug #36629 (SoapServer::handle() exits on SOAP faults) +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php +function test1() { + throw new SoapFault("Server", "test1"); +} +function test2() { + return new SoapFault("Server", "test2"); +} + +$server = new soapserver(null,array('uri'=>"http://testuri.org")); +$server->addfunction(array("test1","test2")); + +$HTTP_RAW_POST_DATA = <<<EOF +<?xml version="1.0" encoding="ISO-8859-1"?> +<SOAP-ENV:Envelope + SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:si="http://soapinterop.org/xsd"> + <SOAP-ENV:Body> + <ns1:test1 xmlns:ns1="http://testuri.org" /> + </SOAP-ENV:Body> +</SOAP-ENV:Envelope> +EOF; +$server->handle(); + +$HTTP_RAW_POST_DATA = <<<EOF +<?xml version="1.0" encoding="ISO-8859-1"?> +<SOAP-ENV:Envelope + SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:si="http://soapinterop.org/xsd"> + <SOAP-ENV:Body> + <ns1:test2 xmlns:ns1="http://testuri.org" /> + </SOAP-ENV:Body> +</SOAP-ENV:Envelope> +EOF; +$server->handle(); +echo "ok\n"; +?> +--EXPECT-- +<?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>test1</faultstring></SOAP-ENV:Fault></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/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>test2</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope> +ok |
