]> granicus.if.org Git - php/commitdiff
MFH: fix #42736 (xmlrpc_server_call_method() crashes)
authorAntony Dovgal <tony2001@php.net>
Mon, 12 Nov 2007 11:24:13 +0000 (11:24 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 12 Nov 2007 11:24:13 +0000 (11:24 +0000)
NEWS
ext/xmlrpc/tests/bug42736.phpt [new file with mode: 0644]
ext/xmlrpc/xmlrpc-epi-php.c

diff --git a/NEWS b/NEWS
index abd34811f6f3eb453224ed8e2469efc64b514738..f50599b55f412b34da64ededf0a9cfe9e93b5b45 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ PHP                                                                        NEWS
   segfault). (Dmitry)
 - Fixed bug #42937 (__call() method not invoked when methods are called on
   parent from child class). (Dmitry)
+- Fixed bug #42736 (xmlrpc_server_call_method() crashes). (Tony)
 
 08 Nov 2007, PHP 5.2.5
 - Upgraded PCRE to version 7.3 (Nuno)
diff --git a/ext/xmlrpc/tests/bug42736.phpt b/ext/xmlrpc/tests/bug42736.phpt
new file mode 100644 (file)
index 0000000..b9a46cf
--- /dev/null
@@ -0,0 +1,56 @@
+--TEST--
+Bug #42736 (xmlrpc_server_call_method() crashes)
+--SKIPIF--
+<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
+--FILE--
+<?php
+
+class SOAP_Array {
+       public function get($id){
+               return $this->add($id);
+       }
+}
+
+$xml = xmlrpc_server_create();
+
+$Myrequest = '<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>GetProducts</methodName><params><param><value><dateTime.iso8601>20060922T14:26:19</dateTime.iso8601></value></param></params></methodCall>';
+
+class MyClass {
+       function GetProducts($dummy, $time){
+               return array('faultString' => $time);
+       }
+}
+$myclass =  new MyClass();
+xmlrpc_server_register_method($xml, 'GetProducts', array($myclass, 'GetProducts'));
+$response = xmlrpc_server_call_method($xml, $Myrequest, null);
+
+var_dump($response);
+
+echo "Done\n";
+?>
+--EXPECTF--    
+string(402) "<?xml version="1.0" encoding="iso-8859-1"?>
+<methodResponse>
+<params>
+ <param>
+  <value>
+   <struct>
+    <member>
+     <name>faultString</name>
+     <value>
+      <array>
+       <data>
+        <value>
+         <dateTime.iso8601>20060922T14:26:19</dateTime.iso8601>
+        </value>
+       </data>
+      </array>
+     </value>
+    </member>
+   </struct>
+  </value>
+ </param>
+</params>
+</methodResponse>
+"
+Done
index c0918a6cbd9b7bd76eb4cf2fd9b42038affb3605..c750a4fdef5424db2c5b94dab703400f294dde63 100644 (file)
@@ -874,10 +874,9 @@ static XMLRPC_VALUE php_xmlrpc_callback(XMLRPC_SERVER server, XMLRPC_REQUEST xRe
 
    pData->php_executed = 1;
 
-       zval_dtor(xmlrpc_params);
-       FREE_ZVAL(xmlrpc_params);
+   zval_ptr_dtor(&xmlrpc_params);
 
-       return NULL;
+   return NULL;
 }
 
 /* called by the C server when it first receives an introspection request.  We pass this on to