summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-11-12 11:24:13 +0000
committerAntony Dovgal <tony2001@php.net>2007-11-12 11:24:13 +0000
commit7a369dc593da48bb4b0382a8f9861e5f86751dfa (patch)
tree977ff5358bb37f95c7803ba0c4fd9b166ccb4edf
parent2ea310593911cb75d4d178c1149f22a693d2a85e (diff)
downloadphp-git-7a369dc593da48bb4b0382a8f9861e5f86751dfa.tar.gz
MFH: fix #42736 (xmlrpc_server_call_method() crashes)
-rw-r--r--NEWS1
-rw-r--r--ext/xmlrpc/tests/bug42736.phpt56
-rw-r--r--ext/xmlrpc/xmlrpc-epi-php.c5
3 files changed, 59 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index abd34811f6..f50599b55f 100644
--- 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
index 0000000000..b9a46cff5c
--- /dev/null
+++ b/ext/xmlrpc/tests/bug42736.phpt
@@ -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
diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c
index c0918a6cbd..c750a4fdef 100644
--- a/ext/xmlrpc/xmlrpc-epi-php.c
+++ b/ext/xmlrpc/xmlrpc-epi-php.c
@@ -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