php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45975 SoapClient tries to convert stdClass into string
Submitted: 2008-09-02 16:05 UTC Modified: 2009-02-21 01:00 UTC
Votes:17
Avg. Score:4.2 ± 1.3
Reproduced:16 of 16 (100.0%)
Same Version:9 (56.2%)
Same OS:3 (18.8%)
From: v0idnull at psikon dot com Assigned:
Status: No Feedback Package: SOAP related
PHP Version: 5.2.6 OS: Ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: v0idnull at psikon dot com
New email:
PHP Version: OS:

 

 [2008-09-02 16:05 UTC] v0idnull at psikon dot com
Description:
------------
Call a webservice method. Method returns one value, a string. SoapClient internally tries to convert an instance of stdClass into a string before trying to return the value, thus nothing works.

Reproduce code:
---------------
$packet = array('sessionToken' => $this->searchAuth, 'userId' => '-1', 'expirationDate' => '2008-11-01');
// $this->soap is instance of SoapClient
$results = $this->soap->__soapCall('GenerateToken',array($packet));
var_dump($results);

Webservice returns:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GenerateTokenResponse xmlns="~/WebServices/">
      <GenerateTokenResult>string</GenerateTokenResult>
    </GenerateTokenResponse>
  </soap12:Body>
</soap12:Envelope>



Expected result:
----------------
A string containing the value of "GeneratTokenResult"

OR

class stdClass
{
    public $GenerateTokenResult = 'someKindOfToken';
}

Actual result:
--------------
Catchable fatal error: Object of class stdClass could not be converted to string

error is thrown on the line with __soapCall().

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-13 23:17 UTC] felipe@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-02-21 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".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC