]> granicus.if.org Git - php/commitdiff
Fixed bug #30175 (SOAP results aren't parsed correctly)
authorDmitry Stogov <dmitry@php.net>
Tue, 5 Oct 2004 15:58:28 +0000 (15:58 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 5 Oct 2004 15:58:28 +0000 (15:58 +0000)
NEWS
ext/soap/php_packet_soap.c
ext/soap/tests/bugs/bug30175.phpt [new file with mode: 0644]
ext/soap/tests/bugs/bug30175.wsdl [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 54a24cdde8afa69b8622ab686e2c500247bb4ff4..d88f41fb01504f61793ca20f7d2c5a78d88d1b24 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ PHP                                                                        NEWS
 - Fixed bug #30276 (Possible crash in ctype_digit on large numbers). (Ilia)
 - Fixed bug #30224 (Sybase date strings are sometimes not null terminated).
   (Ilia)
+- Fixed bug #30175 (SOAP results aren't parsed correctly). (Dmitry)
 - Fixed bug #30147 (OO sqlite_fetch_object did not reset error handler). (Wez)
 - Fixed bug #30133 (get_current_user() crashes on Windows). (Edin)
 - Fixed bug #30057 (did not detect IPV6 on FreeBSD 4.1). (Wez)
index 2b781e868efa3fd721e0c7fd07e880ae045a3530..7b0465f1f2ae5d90e386d6ce030b0b4230cfe5ba 100644 (file)
@@ -271,6 +271,9 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
                                                cur = get_node(resp, name);
                                                /* TODO: produce warning invalid ns */
                                        }
+                                       if (!cur && fnb->style == SOAP_RPC) {
+                                         cur = resp;
+                                       }
                                        if (cur) {
                                                if (fnb->style == SOAP_DOCUMENT) {
                                                        val = cur;
diff --git a/ext/soap/tests/bugs/bug30175.phpt b/ext/soap/tests/bugs/bug30175.phpt
new file mode 100644 (file)
index 0000000..f5501ac
--- /dev/null
@@ -0,0 +1,47 @@
+--TEST--
+Bug #30175 (SOAP results aren't parsed correctly)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+
+class LocalSoapClient extends SoapClient {
+
+  function __doRequest($request, $location, $action, $version) {
+    return <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope
+xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
+xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:ns1="urn:qweb">
+<SOAP-ENV:Body
+SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+id="_0">
+<ns1:HostInfo xsi:type="ns1:HostInfo">
+<name xsi:type="xsd:string">blah blah some name field</name>
+<shortDescription xsi:type="xsd:string">This is a description. more blah blah blah</shortDescription>
+<ipAddress xsi:type="xsd:string">127.0.0.1</ipAddress>
+</ns1:HostInfo>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
+EOF;
+  }
+
+}
+
+$client = new LocalSoapClient(dirname(__FILE__)."/bug30175.wsdl");
+var_dump($client->qwebGetHostInfo());
+?>
+--EXPECT--
+array(3) {
+  ["name"]=>
+  string(25) "blah blah some name field"
+  ["shortDescription"]=>
+  string(42) "This is a description. more blah blah blah"
+  ["ipAddress"]=>
+  string(9) "127.0.0.1"
+}
diff --git a/ext/soap/tests/bugs/bug30175.wsdl b/ext/soap/tests/bugs/bug30175.wsdl
new file mode 100644 (file)
index 0000000..f4cae25
--- /dev/null
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<definitions name="qweb"\r
+ targetNamespace="http://www.newsblob.com/qweb.wsdl"\r
+ xmlns:tns="http://www.newsblob.com/qweb.wsdl"\r
+ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"\r
+ xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"\r
+ xmlns:ns1="urn:qweb"\r
+ xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"\r
+ xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"\r
+ xmlns="http://schemas.xmlsoap.org/wsdl/">\r
+\r
+<types>\r
+\r
+ <schema targetNamespace="urn:qweb"\r
+  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"\r
+  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"\r
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema"\r
+  xmlns:ns1="urn:qweb"\r
+  xmlns="http://www.w3.org/2001/XMLSchema"\r
+  elementFormDefault="unqualified"\r
+  attributeFormDefault="unqualified">\r
+  <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>\r
+  <complexType name="qwebGetHostInfoResponse">\r
+   <sequence>\r
+    <element name="return" type="ns1:HostInfo" minOccurs="1" maxOccurs="1"/>\r
+   </sequence>\r
+  </complexType>\r
+  <complexType name="ArrayOfHostInfo">\r
+   <complexContent>\r
+    <restriction base="SOAP-ENC:Array">\r
+     <sequence>\r
+      <element name="item" type="ns1:HostInfo" minOccurs="0" maxOccurs="unbounded"/>\r
+     </sequence>\r
+     <attribute ref="SOAP-ENC:arrayType" WSDL:arrayType="ns1:HostInfo[]"/>\r
+    </restriction>\r
+   </complexContent>\r
+  </complexType>\r
+ </schema>\r
+\r
+</types>\r
+\r
+<message name="qwebSquareRequest">\r
+ <part name="mynum" type="xsd:int"/>\r
+</message>\r
+\r
+<message name="qwebSquareResponse">\r
+ <part name="result" type="xsd:int"/>\r
+</message>\r
+\r
+<message name="qwebStrlenRequest">\r
+ <part name="mystr" type="xsd:string"/>\r
+</message>\r
+\r
+<message name="qwebStrlenResponse">\r
+ <part name="result" type="xsd:int"/>\r
+</message>\r
+\r
+<message name="qwebGetHostInfoRequest">\r
+</message>\r
+\r
+<message name="HostInfo">\r
+ <part name="name" type="xsd:string"/>\r
+ <part name="shortDescription" type="xsd:string"/>\r
+ <part name="ipAddress" type="xsd:string"/>\r
+</message>\r
+\r
+<portType name="qwebPortType">\r
+ <operation name="qwebSquare">\r
+  <documentation>Service definition of function ns1__qwebSquare</documentation>\r
+  <input message="tns:qwebSquareRequest"/>\r
+  <output message="tns:qwebSquareResponse"/>\r
+ </operation>\r
+ <operation name="qwebStrlen">\r
+  <documentation>Service definition of function ns1__qwebStrlen</documentation>\r
+  <input message="tns:qwebStrlenRequest"/>\r
+  <output message="tns:qwebStrlenResponse"/>\r
+ </operation>\r
+ <operation name="qwebGetHostInfo">\r
+  <documentation>Service definition of function ns1__qwebGetHostInfo</documentation>\r
+  <input message="tns:qwebGetHostInfoRequest"/>\r
+  <output message="tns:HostInfo"/>\r
+ </operation>\r
+</portType>\r
+\r
+<binding name="qweb" type="tns:qwebPortType">\r
+ <SOAP:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>\r
+ <operation name="qwebSquare">\r
+  <SOAP:operation style="rpc" soapAction=""/>\r
+  <input>\r
+   <SOAP:body use="encoded" namespace="urn:qweb" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>\r
+  </input>\r
+  <output>\r
+   <SOAP:body use="encoded" namespace="urn:qweb" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>\r
+  </output>\r
+ </operation>\r
+ <operation name="qwebStrlen">\r
+  <SOAP:operation style="rpc" soapAction=""/>\r
+  <input>\r
+   <SOAP:body use="encoded" namespace="urn:qweb" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>\r
+  </input>\r
+  <output>\r
+   <SOAP:body use="encoded" namespace="urn:qweb" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>\r
+  </output>\r
+ </operation>\r
+ <operation name="qwebGetHostInfo">\r
+  <SOAP:operation style="rpc" soapAction=""/>\r
+  <input>\r
+   <SOAP:body use="encoded" namespace="urn:qweb" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>\r
+  </input>\r
+  <output>\r
+   <SOAP:body use="encoded" namespace="urn:qweb" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>\r
+  </output>\r
+ </operation>\r
+</binding>\r
+\r
+<service name="qweb">\r
+ <documentation>Demo Qweb SOAP interface</documentation>\r
+ <port name="qweb" binding="tns:qweb">\r
+  <SOAP:address location="http://www.newsblob.com:6969"/>\r
+ </port>\r
+</service>\r
+\r
+</definitions>\r