ID:               47818
 Updated by:       j...@php.net
 Reported By:      galaxy dot mipt at gmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         XMLRPC-EPI related
 Operating System: Linux 2.6.18 x86
 PHP Version:      5.2.9
 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2009-03-28 04:04:16] galaxy dot mipt at gmail dot com

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 this bug report at http://bugs.php.net/?id=47818&edit=1

Reply via email to