PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Web Services » XML_RPC » Bug #1689

XML_RPC_Encode can't handle php5 objects

Details

Submitted2004-06-21 00:10 UTC
Fromtony at tonybibbs dot com
Assigneddanielc
StatusBogus
PackageXML_RPC
PHP Version5.0.0RC3 (Release Candidate 3)
OSLinux 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));
?>