php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66503 Fatal error in SoapClient isn't really fatal
Submitted: 2014-01-16 21:53 UTC Modified: 2018-03-23 11:43 UTC
Votes:9
Avg. Score:4.3 ± 0.8
Reproduced:8 of 8 (100.0%)
Same Version:1 (12.5%)
Same OS:4 (50.0%)
From: gordon dot mcvey at ntlworld dot com Assigned: nikic (profile)
Status: Closed Package: SOAP related
PHP Version: 5.4.24 OS: Ubuntu Linux, Mac OSX Lion
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gordon dot mcvey at ntlworld dot com
New email:
PHP Version: OS:

 

 [2014-01-16 21:53 UTC] gordon dot mcvey at ntlworld dot com
Description:
------------
Dealing with the SoapClient in PHP inside a try block produces an unexpected result when a failure to connect occurs. A fatal error will be logged or displayed (depending on error_reporting, display_errors and error logging settings) but the script will continue to execute.  


Test script:
---------------
<?php

echo "start\n";

try {
   $test = new SoapClient ('http://www.example.com/');
} catch (Exception $e) {
   echo "Caught exception\n";
}

echo "end\n";

Expected result:
----------------
Either
======
start
Caught exception
end

Or
======
start
PHP Fatal error:  SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.example.com/' : Extra content at the end of the document
 in soapfail.php on line 6



Actual result:
--------------
start
PHP Fatal error:  SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.example.com/' : Extra content at the end of the document
 in soapfail.php on line 6
Caught exception
end


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-16 21:56 UTC] gordon dot mcvey at ntlworld dot com
PHP 5.4.6-1ubuntu1.5 (cli) (built: Dec 12 2013 04:39:44) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans

I also tested this on my home machine with similar results.

PHP 5.5.5 (cli) (built: Oct 20 2013 23:15:05) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies with Xdebug v2.2.2, Copyright (c) 2002-2013, by Derick Rethans
 [2015-05-13 15:38 UTC] abasso at emporos dot net
I am experiencing the same issue with PHP 5.5.16.

PHP should not log a fatal error then continuing the execution. In fact, not being able to retrieve the WSDL should simply generate an exception which can be handled by the script calling the SoapClient class.
 [2018-03-23 11:43 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2018-03-23 11:43 UTC] nikic@php.net
This got fixed by bug #70469 in 7.1.14/7.2.2.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 08:01:30 2024 UTC