php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: basicer at basicer dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-24 11:32 UTC] svn@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=291260
Log: - Fixed bug #50282 (xmlrpc_encode_request() changes object into array in calling function)
 [2009-11-24 11:32 UTC] felipe@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 02:01:29 2024 UTC