dmitry          Fri Aug 31 08:07:46 2007 UTC

  Modified files:              
    /php-src/ext/soap   php_encoding.c 
    /php-src/ext/soap/tests/bugs        bug42326.phpt bug42326.wsdl 
  Log:
  Fixed bug #42326 (SoapServer crash)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_encoding.c?r1=1.161&r2=1.162&diff_format=u
Index: php-src/ext/soap/php_encoding.c
diff -u php-src/ext/soap/php_encoding.c:1.161 
php-src/ext/soap/php_encoding.c:1.162
--- php-src/ext/soap/php_encoding.c:1.161       Wed Aug 22 14:18:28 2007
+++ php-src/ext/soap/php_encoding.c     Fri Aug 31 08:07:46 2007
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_encoding.c,v 1.161 2007/08/22 14:18:28 dmitry Exp $ */
+/* $Id: php_encoding.c,v 1.162 2007/08/31 08:07:46 dmitry Exp $ */
 
 #include <time.h>
 
@@ -358,7 +358,7 @@
        return 0;
 }
 
-xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr 
parent)
+static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, 
xmlNodePtr parent, int use_class_map)
 {
        xmlNodePtr node = NULL;
        TSRMLS_FETCH();
@@ -445,7 +445,7 @@
                        xmlSetNs(node, nsp);
                }
        } else {
-               if (SOAP_GLOBAL(class_map) && data &&
+               if (use_class_map && SOAP_GLOBAL(class_map) && data &&
                    Z_TYPE_P(data) == IS_OBJECT &&
                    !Z_OBJPROP_P(data)->nApplyCount) {
                        zend_class_entry *ce = Z_OBJCE_P(data);
@@ -518,6 +518,11 @@
        return node;
 }
 
+xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr 
parent)
+{
+       return master_to_xml_int(encode, data, style, parent, 1);
+}
+
 static zval *master_to_zval_int(encodePtr encode, xmlNodePtr data)
 {
        zval *ret = NULL;
@@ -2662,7 +2667,7 @@
        } else {
                enc = get_conversion(IS_NULL);
        }
-       ret = master_to_xml(enc, data, style, parent);
+       ret = master_to_xml_int(enc, data, style, parent, 0);
 /*
        if (style == SOAP_LITERAL && SOAP_GLOBAL(sdl)) {
                set_ns_and_type(ret, &enc->details);
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug42326.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/soap/tests/bugs/bug42326.phpt
diff -u /dev/null php-src/ext/soap/tests/bugs/bug42326.phpt:1.2
--- /dev/null   Fri Aug 31 08:07:46 2007
+++ php-src/ext/soap/tests/bugs/bug42326.phpt   Fri Aug 31 08:07:46 2007
@@ -0,0 +1,49 @@
+--TEST--
+Bug #42326 (SoapServer crash)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+$request = <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:ns1="http://www.example.com/";><SOAP-ENV:Body><ns1:GetProductsRequest><time></time></ns1:GetProductsRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
+EOF;
+
+
+$soap_admin_classmap = array('productDetailsType' => 'SOAP_productDetailsType',
+                             'GetProductsRequest' => 'SOAP_GetProductsRequest',
+                             'GetProductsResponse' => 
'SOAP_GetProductsResponse');
+
+class SOAP_productDetailsType {
+    public $id = 0;
+}
+
+class SOAP_GetProductsRequest {
+    public $time = '';
+}
+
+class SOAP_GetProductsResponse {
+    public $products;
+    function __construct(){
+        $this->products = new SOAP_productDetailsType();
+        
+    }
+}
+
+class SOAP_Admin {
+    public function GetProducts($time){
+        return new SOAP_GetProductsResponse();
+    }
+}
+
+$soap = new SoapServer(dirname(__FILE__).'/bug42326.wsdl', array('classmap' => 
$soap_admin_classmap));
+$soap->setClass('SOAP_Admin');
+ob_start();
+$soap->handle($request);
+ob_end_clean();
+echo "ok\n";
+?>
+--EXPECT--
+ok
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug42326.wsdl?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/soap/tests/bugs/bug42326.wsdl
diff -u /dev/null php-src/ext/soap/tests/bugs/bug42326.wsdl:1.2
--- /dev/null   Fri Aug 31 08:07:46 2007
+++ php-src/ext/soap/tests/bugs/bug42326.wsdl   Fri Aug 31 08:07:46 2007
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<wsdl:definitions name="OSCAdmin.wsdl"
+targetNamespace="http://www.example.com/";
+xmlns:tns="http://www.example.com/";
+xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
+xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";>          
+    <wsdl:types>
+
+       <xsd:schema targetNamespace="http://www.example.com/";
+              xmlns="http://www.w3.org/2000/10/XMLSchema";>
+              <xsd:element name="productDetailsType">
+              <xsd:complexType>
+              <xsd:all>
+              <xsd:element name="id" type="xsd:integer"/>
+              
+              </xsd:all>
+              </xsd:complexType>
+              </xsd:element>
+       </xsd:schema>
+
+
+       <xsd:schema targetNamespace="http://www.example.com/";
+              xmlns="http://www.w3.org/2000/10/XMLSchema";>
+              <xsd:element name="GetProductsRequest">
+              <xsd:complexType>
+              <xsd:all>
+              <xsd:element name="time" type="xsd:string"/>
+              </xsd:all>
+              </xsd:complexType>
+              </xsd:element>
+       </xsd:schema>
+
+       <xsd:schema targetNamespace="http://www.example.com/";
+              xmlns="http://www.w3.org/2000/10/XMLSchema";>
+              <xsd:element name="GetProductsResponse">
+              <xsd:complexType>
+              <xsd:all>
+              <xsd:element name="products" type="tns:productDetailsType"/>
+              </xsd:all>
+              </xsd:complexType>
+              </xsd:element>
+       </xsd:schema>
+
+       
+    </wsdl:types>
+
+    <wsdl:message name="GetProductsRequest">
+        <wsdl:part name="in" element="tns:GetProductsRequest"/>
+    </wsdl:message>
+
+    <wsdl:message name="GetProductsResponse">
+        <wsdl:part name="out" element="tns:GetProductsResponse"/>
+    </wsdl:message>
+
+    <wsdl:portType name="OSCAdminPortType">
+        <wsdl:operation name="GetProducts">
+           <wsdl:input message="tns:GetProductsRequest"/>
+           <wsdl:output message="tns:GetProductsResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+    <wsdl:binding name="OSCAdminSoapBinding" type="tns:OSCAdminPortType">
+        <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="GetProducts">
+           <soap:operation soapAction=""/>
+           <wsdl:input name="in">
+               <soap:body use="literal"/>
+           </wsdl:input>
+           <wsdl:output name="out">
+               <soap:body use="literal"/>
+           </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+    <wsdl:service name="OSCAdminService">
+        <wsdl:port name="OSCAdminPort" binding="tns:OSCAdminSoapBinding">
+           <soap:address location="test://"/>
+        </wsdl:port>
+    </wsdl:service>
+
+</wsdl:definitions>
\ No newline at end of file

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to