bug47818.phpt 886 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. class MyXmlRpc {
  8. private $s;
  9. private $method;
  10. function impl($method_name, $params, $user_data){
  11. $this->method = $method_name;
  12. print "Inside impl(): {$this->method}\n";
  13. return array_sum($params);
  14. }
  15. function __construct() {
  16. $this->s = xmlrpc_server_create();
  17. xmlrpc_server_register_method($this->s, 'add', array($this, 'impl'));
  18. }
  19. function call($req) {
  20. return xmlrpc_server_call_method($this->s, $req, null);
  21. }
  22. function getMethod() {return $this->method;}
  23. }
  24. $x = new MyXmlRpc;
  25. $resp = $x->call(xmlrpc_encode_request('add', array(1, 2, 3)));
  26. $method = $x->getMethod();
  27. print "Global scope: $method\n";
  28. ?>
  29. --EXPECTF--
  30. Inside impl(): add
  31. Global scope: add