Re: Returning Object Through PEAR::SOAP and troubles with php5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi again,

mybe i have a fix for the php5 problem in line 582:
"Trying to reference a non valid object: libs/PEAR/SOAP/Client.php on line
582"

I did following:

>go to line 560 in Client.php:
// decode to native php datatype
$returnArray =& $this->_decode($response);

>add below
$ret_array_copy = $returnArray;

>go to line 567 and change it like this:
if (is_object($returnArray) &&
strcasecmp(get_class($returnArray),'stdClass')==0) {
$returnArray = get_object_vars($ret_array_copy);

Now it should work fine (it does on my system)

greets
jan






"Sirlancelot" <lancelot@metalmiddleage.it> schrieb im Newsbeitrag
20031229145325.53590.qmail@pb1.pair.com">news:20031229145325.53590.qmail@pb1.pair.com...
> Hi guys,
> i'm an italian PHP developer, and i'm trying to improve my knowledge about
> web services.
>
> First I want to know if it is possible in any way to return objects from a
> php pear::soap server.
>
> I'm experimenting php5 too, so I tried to convert some work, and I found a
> big problem with PEAR::SOAP 0.7.5 and php5.0.0b3:
>
> System: Windows XP/Apache 1.3.29/PHP5.0.0b3/MySQL 4.0.1/
>
> PEAR VERSIONS:
> PEAR-BASE-1.2.1 - PEAR-SOAP 0.7.5
>
> I exposed as web service the following method of a class:
>
> function dbGetOne($id)
> {
>   if(!is_numeric($id))
>      return "wrong ID passed!";
>
>   $dsn = array(
>     "phptype"=>"mysql",
>     "hostspec"=>"myhost",
>     "database"=>"mydb",
>     "username"=>"myuser",
>     "password"=> "mypassword"
>   );
>
>   $db = DB::connect($dsn);
>
>   $query="SELECT * FROM actions WHERE ID=". $id;
>
>   $result = $db->query($query);
>
>   if($row=$result->fetchRow(DB_FETCHMODE_ASSOC))
>     return $row;
>   else
>     return "no data found for record: ".$id;
> }
>
> in php4.3.4 this method works fine, but in php5 I got this fatal error:
>
> Trying to reference a non valid object: libs/PEAR/SOAP/Client.php on line
> 582
>
> that is: return array_shift($returnArray)
>
>
> Thanks in advance for your help!!
>
>
> Greeting and wishes of happy new year :)
>
>
> Giorgio from Rome

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux