php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63474 Fatal errors may be thrown when turning off exceptions
Submitted: 2012-11-09 19:06 UTC Modified: -
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: dean at deansas dot org Assigned:
Status: Open Package: SOAP related
PHP Version: 5.3.18 OS:
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: dean at deansas dot org
New email:
PHP Version: OS:

 

 [2012-11-09 19:06 UTC] dean at deansas dot org
Description:
------------
When disabling exceptions in the constructor to SoapClient, I did not expect that 
for some errors it would trigger warnings and fatal errors. I did expect that it 
would return SoapFault objects instead, as documented on 
http://uk3.php.net/manual/en/function.is-soap-fault.php.

In the event that this is expected behaviour then the documentation should make 
this clear.

Test script:
---------------
// URL requiring http auth and passing incorrect username & password
$foo = new SoapClient("http://example.com/foo.wsdl",
    array( 'login' => 'bar', 'password' => 'baz', 'exceptions' => false));
print $foo;


Expected result:
----------------
That $foo is a SoapFault object, no warnings/errors are thrown and something like 
the below is output:

[WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://example.com/foo.wsdl' 
: failed to load external entity "http://example.com/foo.wsdl"
 in test.php:4
Stack trace:
#0 test.php(4): SoapClient->SoapClient('http://example....', Array)
#1 {main}

Actual result:
--------------
Warning: SoapClient::SoapClient(http://example.com/foo.wsdl): failed to open 
stream: HTTP request failed! HTTP/1.1 401 Authorization Required
 in test.php on line 4

Warning: SoapClient::SoapClient(): I/O warning : failed to load external entity 
"http://example.com/foo.wsdl" in test.php on line 4

Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 
'http://example.com/foo.wsdl' : failed to load external entity 
"http://example.com/foo.wsdl"
 in test.php on line 4


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-30 09:14 UTC] dmeziere at free dot fr
$foo won't be a SoapFault object. SoapFault is an excepion. And an exception is thrown, not instanciated.
 [2012-11-30 10:40 UTC] dean at deansas dot org
@dmeziere The http://php.net/is-soap-fault page says,

"This function is useful to check if the SOAP call failed, but without using 
exceptions. To use it, create a SoapClient object with the exceptions option set 
to zero or FALSE. In this case, the SOAP method will return a special SoapFault 
object."

Is the documentation incorrect or has one of us misunderstood something?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC