Question on type casting for SOAP
| From: | Jim Plush | Date: | Tue, 12 Jul 2005 00:08:24 +0000 |
| Subject: | Question on type casting for SOAP | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-1957@lists.php.net to get a copy of this message | ||
I'm trying to merge from nuSOAP to the PHP5 SOAP ext and I'm getting a fatal error
b>Fatal error</b>: Cannot use object of type stdClass as array
when I var_dump the results of my soap call I noticed the array it returns is an array of objects?
array(6) {
[0]=>
object(stdClass)#12 (6) {
["N1"]=>
int(88)
["N2"]=>
int(98)
["S1"]=>
string(12) "this is a test"
["S2"]=>
string(9) "http"
["S3"]=>
string(3) "tcp"
["S4"]=>
string(24) "Linux Configuration Tool"
}
however nusoap returns as a standard array and the only way I got the old code to work was to cast as an array as I loop through the results
foreach ($array as $key=>$value)
$value = (array)$value;
which sucks for backwards compatibility. Anyone have any better ideas on how I might be able to resolve the issue?