]> granicus.if.org Git - php/commitdiff
- New tests
authorFelipe Pena <felipe@php.net>
Fri, 18 Jul 2008 19:24:49 +0000 (19:24 +0000)
committerFelipe Pena <felipe@php.net>
Fri, 18 Jul 2008 19:24:49 +0000 (19:24 +0000)
ext/xmlrpc/tests/bug45555.phpt [new file with mode: 0644]
ext/xmlrpc/tests/bug45556.phpt [new file with mode: 0644]

diff --git a/ext/xmlrpc/tests/bug45555.phpt b/ext/xmlrpc/tests/bug45555.phpt
new file mode 100644 (file)
index 0000000..376b14f
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+Bug #45555 (Segfault with invalid non-string as register_introspection_callback)
+--FILE--
+<?php
+
+$options = array ();
+$request = xmlrpc_encode_request ("system.describeMethods", $options);
+$server = xmlrpc_server_create ();
+
+xmlrpc_server_register_introspection_callback($server, 1);
+xmlrpc_server_register_introspection_callback($server, array('foo', 'bar'));
+
+$options = array ('output_type' => 'xml', 'version' => 'xmlrpc');
+xmlrpc_server_call_method ($server, $request, NULL, $options);
+
+?>
+--EXPECTF--
+Warning: xmlrpc_server_call_method(): Invalid callback '1' passed in %s on line %d
+
+Warning: xmlrpc_server_call_method(): Invalid callback 'foo::bar' passed in %s on line %d
diff --git a/ext/xmlrpc/tests/bug45556.phpt b/ext/xmlrpc/tests/bug45556.phpt
new file mode 100644 (file)
index 0000000..9c73e0e
--- /dev/null
@@ -0,0 +1,41 @@
+--TEST--
+Bug #45556 (Return value from callback isn't freed)
+--FILE--
+<?php
+
+$options = array ();
+$request = xmlrpc_encode_request ("system.describeMethods", $options);
+$server = xmlrpc_server_create ();
+
+
+function foo() { return 11111; }
+
+class bar {
+       static public function test() {
+               return 'foo';
+       }
+}
+
+xmlrpc_server_register_introspection_callback($server, 'foobar');
+xmlrpc_server_register_introspection_callback($server, array('bar', 'test'));
+xmlrpc_server_register_introspection_callback($server, array('foo', 'bar'));
+
+$options = array ('output_type' => 'xml', 'version' => 'xmlrpc');
+xmlrpc_server_call_method ($server, $request, NULL, $options);
+
+?>
+--EXPECTF--
+
+Warning: xmlrpc_server_call_method(): Invalid callback 'foobar' passed in %s on line %d
+expat reports error code 5
+       description: Invalid document end
+       line: 1
+       column: 1
+       byte index: 0
+       total bytes: 0
+
+       data beginning 0 before byte index: foo
+Warning: xmlrpc_server_call_method(): xml parse error: [line 1, column 1, message: Invalid document end] Unable to add introspection data returned from bar::test() in %s on line %d
+
+Warning: xmlrpc_server_call_method(): Invalid callback 'foo::bar' passed in %s on line %d