summaryrefslogtreecommitdiff
path: root/ext/xmlrpc/tests/bug47818.phpt
blob: a2944d8ec23392fa5aae72628fe61f5997f3bac9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--TEST--
Bug #47818 (Segfault due to bound callback param)
--SKIPIF--
<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
--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