dmitry          Wed Feb 18 13:25:59 2009 UTC

  Modified files:              
    /php-src/ext/soap   soap.c 
    /php-src/ext/soap/tests/bugs        bug47049.phpt bug47049.wsdl 
  Log:
  Fixed bug #47049 (SoapClient::__soapCall causes a segmentation fault)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/soap.c?r1=1.259&r2=1.260&diff_format=u
Index: php-src/ext/soap/soap.c
diff -u php-src/ext/soap/soap.c:1.259 php-src/ext/soap/soap.c:1.260
--- php-src/ext/soap/soap.c:1.259       Mon Feb  2 09:59:49 2009
+++ php-src/ext/soap/soap.c     Wed Feb 18 13:25:59 2009
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <dmi...@zend.com>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: soap.c,v 1.259 2009/02/02 09:59:49 felipe Exp $ */
+/* $Id: soap.c,v 1.260 2009/02/18 13:25:59 dmitry Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -4821,7 +4821,17 @@
                /*style = SOAP_RPC;*/
                if (style == SOAP_RPC) {
                        ns = encode_add_ns(body, uri);
-                       method = xmlNewChild(body, ns, BAD_CAST(function_name), 
NULL);
+                       if (function_name) {
+                               method = xmlNewChild(body, ns, 
BAD_CAST(function_name), NULL);
+                       } else if (function && function->requestName) {
+                               method = xmlNewChild(body, ns, 
BAD_CAST(function->requestName), NULL);
+                       } else if (function && function->functionName) {
+                               method = xmlNewChild(body, ns, 
BAD_CAST(function->functionName), NULL);
+                       } else {
+                               method = body;
+                       }
+               } else {
+                       method = body;
                }
 
                if (client->use == SOAP_LITERAL) {
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug47049.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/soap/tests/bugs/bug47049.phpt
diff -u /dev/null php-src/ext/soap/tests/bugs/bug47049.phpt:1.2
--- /dev/null   Wed Feb 18 13:25:59 2009
+++ php-src/ext/soap/tests/bugs/bug47049.phpt   Wed Feb 18 13:25:59 2009
@@ -0,0 +1,19 @@
+--TEST--
+Bug #47049 (SoapClient::__soapCall causes a segmentation fault)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+$client = new SoapClient(dirname(__FILE__) . '/bug47049.wsdl',
+       array('trace' => 1 , 'exceptions' => 0));
+$host = array('uuid' => 'foo');
+$software_list = array(array('name' => 'package', 'version' => '1.2.3', 
'state' => 'installed'));
+$updates = array();
+$report_id = $client->__soapCall('reportSoftwareStatus',array($host, 
$software_list, $updates));
+echo $client->__getLastRequest();
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:ns1="http://www.example.org/reporter/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
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:reportSoftwareStatus><host
 xsi:type="ns1:host"><uuid 
xsi:type="xsd:string">foo</uuid></host><software_list 
xsi:type="ns1:software_list"><software xsi:type="ns1:software"><name 
xsi:type="xsd:string">package</name><version 
xsi:type="xsd:string">1.2.3</version><state 
xsi:type="xsd:string">installed</state></software></software_list><updates 
xsi:type="ns1:updates"/></ns1:reportSoftwareStatus></SOAP-ENV:Body></SOAP-ENV:Envelope>
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug47049.wsdl?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/soap/tests/bugs/bug47049.wsdl
diff -u /dev/null php-src/ext/soap/tests/bugs/bug47049.wsdl:1.2
--- /dev/null   Wed Feb 18 13:25:59 2009
+++ php-src/ext/soap/tests/bugs/bug47049.wsdl   Wed Feb 18 13:25:59 2009
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; 
xmlns:tns="http://www.example.org/reporter/"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; name="reporter" 
targetNamespace="http://www.example.org/reporter/"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";>
+    <wsdl:types><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
targetNamespace="http://www.example.org/reporter/";>
+        <xsd:complexType name="host">
+                <xsd:sequence>
+                        <xsd:element name="uuid" 
type="xsd:string"></xsd:element>
+                </xsd:sequence>
+        </xsd:complexType>
+        <xsd:complexType name="software_list">
+                <xsd:sequence>
+                        <xsd:element name="software" type="tns:software"
+                                maxOccurs="unbounded" minOccurs="1">
+                        </xsd:element>
+                </xsd:sequence>
+        </xsd:complexType>
+        <xsd:complexType name="software">
+                <xsd:sequence>
+                        <xsd:element name="name" type="xsd:string" 
maxOccurs="1" minOccurs="1"></xsd:element>
+                        <xsd:element name="version" type="xsd:string" 
maxOccurs="1" minOccurs="1"></xsd:element>
+                    <xsd:element name="state" type="xsd:string" maxOccurs="1" 
minOccurs="1"></xsd:element>
+                </xsd:sequence>
+        </xsd:complexType>
+        <xsd:complexType name="updates">
+                <xsd:sequence>
+                        <xsd:element name="update" type="tns:update"
+                                maxOccurs="unbounded" minOccurs="0">
+                        </xsd:element>
+                </xsd:sequence>
+        </xsd:complexType>
+
+        <xsd:complexType name="update">
+                <xsd:sequence>
+                        <xsd:element name="software" 
type="xsd:string"></xsd:element>
+                        <xsd:element name="old_version" 
type="xsd:string"></xsd:element>
+                        <xsd:element name="new_version" 
type="xsd:string"></xsd:element>
+                </xsd:sequence>
+        </xsd:complexType>
+
+</xsd:schema></wsdl:types>
+    <wsdl:message name="reportSoftwareStatusRequest">
+    <wsdl:part name="host" type="tns:host"/>
+    <wsdl:part name="software_list" type="tns:software_list"></wsdl:part>
+    <wsdl:part name="updates" type="tns:updates"></wsdl:part>
+    </wsdl:message>
+  <wsdl:message name="reportSoftwareStatusResponse">
+    <wsdl:part name="report_id" type="xsd:int"/>
+  </wsdl:message>
+  <wsdl:portType name="reporter">
+    <wsdl:operation name="reportSoftwareStatus">
+      <wsdl:input message="tns:reportSoftwareStatusRequest"/>
+      <wsdl:output message="tns:reportSoftwareStatusResponse"/>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="reporterHTTP" type="tns:reporter">
+
+        <soap:binding style="document"
+                transport="http://schemas.xmlsoap.org/soap/http"; />
+        <wsdl:operation name="reportSoftwareStatus">
+
+                <soap:operation
+                        
soapAction="http://www.example.org/reporter/reportSoftwareStatus"; />
+                <wsdl:input>
+
+
+                        <soap:body use="literal" />
+                </wsdl:input>
+                <wsdl:output>
+
+
+                        <soap:body use="literal" />
+                </wsdl:output>
+        </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="reporter">
+    <wsdl:port binding="tns:reporterHTTP" name="reporterHTTP">
+      <http: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

Reply via email to