xref: /PHP-7.0/ext/xmlrpc/tests/bug42736.phpt (revision 1f1140a9)
1--TEST--
2Bug #42736 (xmlrpc_server_call_method() crashes)
3--SKIPIF--
4<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
5--FILE--
6<?php
7
8class SOAP_Array {
9	public function get($id){
10		return $this->add($id);
11	}
12}
13
14$xml = xmlrpc_server_create();
15
16$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>';
17
18class MyClass {
19	function GetProducts($dummy, $time){
20		return array('faultString' => $time);
21	}
22}
23$myclass =  new MyClass();
24xmlrpc_server_register_method($xml, 'GetProducts', array($myclass, 'GetProducts'));
25$response = xmlrpc_server_call_method($xml, $Myrequest, null);
26
27var_dump($response);
28
29echo "Done\n";
30?>
31--EXPECTF--
32string(402) "<?xml version="1.0" encoding="iso-8859-1"?>
33<methodResponse>
34<params>
35 <param>
36  <value>
37   <struct>
38    <member>
39     <name>faultString</name>
40     <value>
41      <array>
42       <data>
43        <value>
44         <dateTime.iso8601>20060922T14:26:19</dateTime.iso8601>
45        </value>
46       </data>
47      </array>
48     </value>
49    </member>
50   </struct>
51  </value>
52 </param>
53</params>
54</methodResponse>
55"
56Done
57