#47818 [NEW]: Segfault due to bound callback param
[email protected] ("galaxy dot mipt at gmail dot com")
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
From: galaxy dot mipt at gmail dot com
Operating system: Linux 2.6.18 x86
PHP version: 5.2.9
PHP Bug Type: XMLRPC-EPI related
Bug description: Segfault due to bound callback param
Description:
------------
In my particular case when the callback for
xmlrpc_server_register_method() is a class method attempt to save some of
the parameters passed to that callback during xmlrpc_server_call_method()
call results in segfault.
Well, I cannot provide short code that would reproduce the segfault I get
in my application - it's sort of unstable. But the code below at least show
that something is really wrong here.
I believe that $method_name just gets garbage-collected no matter that it
is bound with $this->method. Decoupling them, for example like this,
helps:
$this->method = (string)$method_name;
Reproduce code:
---------------
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";
Expected result:
----------------
Inside impl(): add
Global scope: add
Actual result:
--------------
Inside impl(): add
Global scope:
--
Edit bug report at http://bugs.php.net/?id=47818&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47818&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47818&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47818&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47818&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47818&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47818&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47818&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47818&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47818&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47818&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47818&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47818&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47818&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47818&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47818&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47818&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47818&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47818&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47818&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47818&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47818&r=mysqlcfg