Annotation of embedaddon/php/ext/xmlrpc/tests/bug47818.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #47818 (Segfault due to bound callback param)
        !             3: --SKIPIF--
        !             4: <?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
        !             5: --FILE--
        !             6: <?php
        !             7: 
        !             8: class MyXmlRpc {
        !             9:     private $s;
        !            10:     private $method;
        !            11: 
        !            12:     function impl($method_name, $params, $user_data){
        !            13:         $this->method = $method_name;
        !            14:         print "Inside impl(): {$this->method}\n";
        !            15:         return array_sum($params);
        !            16:     }
        !            17: 
        !            18:     function __construct() {
        !            19:         $this->s = xmlrpc_server_create();
        !            20:         xmlrpc_server_register_method($this->s, 'add', array($this, 'impl'));
        !            21:     }
        !            22: 
        !            23:     function call($req) {
        !            24:         return xmlrpc_server_call_method($this->s, $req, null);
        !            25:     }
        !            26: 
        !            27:     function getMethod() {return $this->method;}
        !            28: 
        !            29: }
        !            30: 
        !            31: $x = new MyXmlRpc;
        !            32: $resp = $x->call(xmlrpc_encode_request('add', array(1, 2, 3)));
        !            33: 
        !            34: $method = $x->getMethod();
        !            35: 
        !            36: print "Global scope: $method\n";
        !            37: 
        !            38: ?>
        !            39: --EXPECTF--
        !            40: Inside impl(): add
        !            41: Global scope: add

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>