Home » Web Services » XML_RPC » Bug #1689
XML_RPC_Encode can't handle php5 objects
Details
| Submitted | 2004-06-21 00:10 UTC |
|---|---|
| From | tony at tonybibbs dot com |
| Assigned | danielc |
| Status | Bogus |
| Package | XML_RPC |
| PHP Version | 5.0.0RC3 (Release Candidate 3) |
| OS | Linux but shouldn't matter |
| Roadmaps | (Not assigned) |
Comments
[2004-06-21 00:10 UTC] tony at tonybibbs dot com
Description:
------------
Version 1.1.0 of PEAR::XML_RPC
Looking into this, XML_RPC_Encode in RPC.php will try to traverse an object, $php_val, as a array. Something with PHP5 prevents encoding objects because they can't be traversed as an array like it does php4 objects. To get around this without touching XML_RPC code I added a toArray() method to any objects I needed to encode that returned an array presentation of my objects. It works but, obviously, the right fix would be made in XML_RPC.
Reproduce code:
---------------
<?php
require_once 'XML/RPC.php'
class foo {
private $someAttribute = 'myValue';
}
$tmp = new foo();
// This will echo out an empty XML_RPC_Value object
// instead of one populated from $tmp
print_r(XML_RPC_Encode($tmp));
?>