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