summaryrefslogtreecommitdiff
path: root/ext/xmlrpc/tests
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2009-04-02 15:52:57 +0000
committerFelipe Pena <felipe@php.net>2009-04-02 15:52:57 +0000
commitc23f8f11345a6a264bbef4f92f7763c2fdb8fc66 (patch)
treef97e5cab76959c6010cc4d6af49609d255fa6ad8 /ext/xmlrpc/tests
parent875a27b7ede3d5b4e0a274017962f788d9176542 (diff)
downloadphp-git-c23f8f11345a6a264bbef4f92f7763c2fdb8fc66.tar.gz
- MFH: Fixed bug #47818 (Segfault due to bound callback param)
Diffstat (limited to 'ext/xmlrpc/tests')
-rw-r--r--ext/xmlrpc/tests/bug47818.phpt39
1 files changed, 39 insertions, 0 deletions
diff --git a/ext/xmlrpc/tests/bug47818.phpt b/ext/xmlrpc/tests/bug47818.phpt
new file mode 100644
index 0000000000..57e1090303
--- /dev/null
+++ b/ext/xmlrpc/tests/bug47818.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Bug #47818 (Segfault due to bound callback param)
+--FILE--
+<?php
+
+class MyXmlRpc {
+ private $s;
+ private $method;
+
+ function impl($method_name, $params, $user_data){
+ $this->method = $method_name;
+ print "Inside impl(): {$this->method}\n";
+ return array_sum($params);
+ }
+
+ function __construct() {
+ $this->s = xmlrpc_server_create();
+ xmlrpc_server_register_method($this->s, 'add', array($this, 'impl'));
+ }
+
+ function call($req) {
+ return xmlrpc_server_call_method($this->s, $req, null);
+ }
+
+ function getMethod() {return $this->method;}
+
+}
+
+$x = new MyXmlRpc;
+$resp = $x->call(xmlrpc_encode_request('add', array(1, 2, 3)));
+
+$method = $x->getMethod();
+
+print "Global scope: $method\n";
+
+?>
+--EXPECTF--
+Inside impl(): add
+Global scope: add