xmlrpc_encode_request() changes object into array in calling function
| Bug #50282 | xmlrpc_encode_request() changes object into array in calling function | ||||
|---|---|---|---|---|---|
| Submitted: | 2009-11-24 10:35 UTC | Modified: | 2009-11-24 11:32 UTC | ||
| From: | basicer at basicer dot com | Assigned: | felipe (profile) | ||
| Status: | Closed | Package: | XMLRPC-EPI related | ||
| PHP Version: | 5.2.11 | OS: | Linux | ||
| Private report: | No | CVE-ID: | None | ||
[2009-11-24 10:35 UTC] basicer at basicer dot com
Description:
------------
Somehow calling xmlrpc_encode_request() will change an object into an array even if the object is passed by reference to the function. xmlrpc_encode_request() creates the correct XML in this case (a struct) but corrupts the original object.
Reproduce code:
---------------
<?php
class One { var $x = 10; }
function go($name, $args) {
$x = xmlrpc_encode_request($name,$args);
}
$o = new One();
print "Start with an object...\n";
var_dump($o);
print "Do some stuff...\n";
go('test',array($o));
print "Now we have an array ?!\n";
var_dump($o);
Expected result:
----------------
Start with an object...
object(One)#1 (1) {
["x"]=>
int(10)
}
Do some stuff...
Now we have an array ?!
object(One)#1 (1) {
["x"]=>
int(10)
}
Actual result:
--------------
Start with an object...
object(One)#1 (1) {
["x"]=>
int(10)
}
Do some stuff...
Now we have an array ?!
array(1) {
["x"]=>
int(10)
}
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2009-11-24 11:32 UTC] felipe@php.net