|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38536 Returning an array of values instead of an object
Submitted: 2006-08-21 13:59 UTC Modified: 2006-11-08 10:06 UTC
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: sabrina at corp dot grupos dot com dot br Assigned: dmitry (profile)
Status: Closed Package: SOAP related
PHP Version: PHP_5_2 cvs OS: FreeBSD 6.1
Private report: No CVE-ID: None
 [2006-08-21 13:59 UTC] sabrina at corp dot grupos dot com dot br
The return soap message should be an array of objects.
Instead, it is returning an array of arrays.
Each item should be an object, but it is an array.
For each item in the array, a value is popped out, such as only the last item in the array has one value and is an object, as it should be.
When using version 5.1.4 is working.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-21 14:02 UTC] sabrina at corp dot grupos dot com dot br
Results of the tests and object dumps are here:
 [2006-08-21 20:06 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

 [2006-08-22 13:11 UTC] sabrina at corp dot grupos dot com dot br

$proxyParams = array('soap_version' => SOAP_1_1, 'trace' => false, 'exceptions' => true, 'encoding' => 'ISO-8859-1', 'location' => $newIp );
try {
	$SOAPObject = new SoapClient('', $proxyParams);
} catch (SoapFault $e) {
	throw new ESoapException($e->faultcode, $e->faultstring, 'initSOAP', $this->componentName, false);

$return = $SOAPObject->__soapCall('getClientInfoFromDomain', '');

/** Var_dump for 5.1.5 can be seen here:
    Var_dump for 5.1.4 can be seen here:

 [2006-08-22 13:51 UTC]
Notice: Undefined variable: newIp in /tmp/1.php on line 4

Warning: SoapClient::__soapCall() expects parameter 2 to be array, string given in /tmp/1.php on line 14

Fatal error: SoapClient::__soapCall(): Invalid parameters in /tmp/1.php on line 14

 [2006-08-22 14:43 UTC] sabrina at corp dot grupos dot com dot br
unfortunately, you cannot execute this code as it is, because the webservice in question is private and cannot be accessed externarly or without authentication.

the line:
$return = $SOAPObject->__soapCall('getClientInfoFromDomain',
is incorrect, and should be:
$return = $SOAPObject->__soapCall('getClientInfoFromDomain',

but other than that, you could either try to access a webservice that returns an array of objects or read the
the result dumps of this script for versions 5.1.4 and 5.1.5 
(you can check these files
) and see that there is a big difference between both responses.

thank you for your replies.
 [2006-08-24 08:06 UTC]
We still need a short reproduce script without private services and fatal errors.
 [2006-09-01 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2006-11-07 14:06 UTC] sabrina at corp dot grupos dot com dot br
 [2006-11-07 18:50 UTC] marcus at corp dot grupos dot com dot br
More info...

-- soap client php --
$arr = array('soap_version'=>SOAP_1_1, 'exceptions'=>true, 'trace'=>1, 'encoding'=>'ISO-8859-1', 'location'=>'');
$SOAPObject = new SoapClient('session.wsdl', $arr);
var_dump($SOAPObject->__soapCall('getClientInfoFromDomain', array('')));

Soap server reply:


Actual result:

Expected result:
 [2006-11-08 10:06 UTC]
Fixed in CVS HEAD and PHP_5_2.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Jun 03 04:03:39 2023 UTC