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 » SOAP » Bug #2984

Wrong variable assignment

Details

Submitted2004-12-17 15:42 UTC
Fromgatterer at in dot tum dot de
Assignedyunosh
StatusClosed
PackageSOAP
PHP VersionIrrelevant
OSWindows
Roadmaps(Not assigned)

Comments

[2004-12-17 15:42 UTC] gatterer at in dot tum dot de

Description:
------------
There is a programming error in version 0.8.1 beta. With this bug there are some strange results within the return object.

Reproduce code:
---------------
Base.php

Line 794:
$return = array($return->{$item->name}, $d);

has to be:
$return->{$item->name} = array($return->{$item->name}, $d);

[2004-12-20 11:08 UTC] gatterer at in dot tum dot de

This produces an error when XML code like this is used:

<Order>
<ProductID>1234</ProductID>
<ProductID>1235</ProductID>
<ProductID>1236</ProductID>
<Sum>500</Sum>
</Order>

This will result in an array like this:

Order => array(
0 => 1234,
1 => 1235,
2 => 1236,
3 => 500,
)

and not

Order
-> ProductID => array(
1234,
1235,
1236,
)

-> Sum => 500

[2005-02-22 10:28 UTC] smith at backendmedia dot com

Could you please provide a unified diff to ensure that even after people have messed with the CVS version it is still possible to locate the place to apply your fix?

[2005-02-22 12:18 UTC] gatterer at in dot tum dot de

794c794
< $return = array($return->{$item->name}, $d);
---
> $return->{$item->name} = array($return->{$item->name}, $d);

[2005-04-04 18:57 UTC] gatterer at in dot tum dot de

Now the problem is on line 793:

} else if (isset($return->{$item->name})) {
$isstruct = FALSE;
if (count(get_object_vars($return)) == 1) {
$d =& $this->_decode($item);
$return = array($return->{$item->name}, $d); // <<<<<<<
else {
$d =& $this->_decode($item);
$return->{$item->name} = array($return->{$item->name}, $d);
}

$return = array($return->{$item->name}, $d);
should be
$return->{$item->name} = array($return->{$item->name}, $d);

For trying you could parse some Amazon SOAP Products and look at the result object. Sometimes the error occurs depending on the XML (see message from 2004-12-20 11:08 UTC).

[2005-04-18 10:57 UTC] gatterer at in dot tum dot de

I have tested with the newest code. The fix I used for the problem in the old version isn't needed anymore. So I think the problem was caused by something else which is fixed now.

So the problem should be solved now.