Bug #75675 [Com]: Uncatchable Fatal error

From: Date: Wed, 13 Dec 2017 11:18:40 +0000
Subject: Bug #75675 [Com]: Uncatchable Fatal error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213081@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75675&edit=1

 ID:                 75675
 Comment by:         spam2 at rhsoft dot net
 Reported by:        fabien dot papet at gmail dot com
 Summary:            Uncatchable Fatal error
 Status:             Open
 Type:               Bug
 Package:            *General Issues
 Operating System:   Windows
 PHP Version:        7.1.12
 Block user comment: N
 Private report:     N

 New Comment:

BTW: in PHP7 "catch(Throwable $exception)" is the way to go in PHP7, it catches even parse
errors in case of eval and so on


Previous Comments:
------------------------------------------------------------------------
[2017-12-13 11:16:10] spam2 at rhsoft dot net

this is *not* a general issue - it's the SOAP extension

i reported that more than a year ago - it's hard to understand why this behvaior don't get
fixed at all because you can't write any sane code based on SOAP requests where it's
naturally that the remote side may not be reachable and you can't handle errors at all the way
it works currently

https://bugs.php.net/bug.php?id=73451

[2017-04-08 10:36 UTC] nikic@php.net
Looks like fatal erros in SOAP were for some reason not part of https://wiki.php.net/rfc/throw_error_in_extensions
-- probably because SOAP uses non-standard macros to generate them.

------------------------------------------------------------------------
[2017-12-13 11:10:59] fabien dot papet at gmail dot com

Description:
------------
It seems like an uncacthable fatal error is thrown with an exception when an url is unreachable

Test script:
---------------
<?php
echo 'start'.PHP_EOL;

set_error_handler(function() {
    echo 'error'.PHP_EOL;
}, E_ALL);

try {
    $client = new SoapClient('http://thisaddressdoesnotexists',
['exceptions' => true, 'trace' => 0]);
} catch (SoapFault $exception) {
    var_dump('Exception: '.$exception->getMessage());
} catch (Exception $exception) {
    var_dump('Exception: '.$exception->getMessage());
}

echo 'end';


Expected result:
----------------
start
string(143) "Exception: SOAP-ERROR: Parsing WSDL: Couldn't load from
'thisaddressdoesnotexists' : failed to load external entity
"thisaddressdoesnotexists"
"
end

Actual result:
--------------
start
error
PHP Fatal error:  SOAP-ERROR: Parsing WSDL: Couldn't load from
'thisaddressdoesnotexists' : failed to load external entity
"thisaddressdoesnotexists"
 in C:\Users\.....\soaptest.php on line 9
string(143) "Exception: SOAP-ERROR: Parsing WSDL: Couldn't load from
'thisaddressdoesnotexists' : failed to load external entity
"thisaddressdoesnotexists"
"
end



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=75675&edit=1


Thread (8 messages)

« previous php.bugs (#213081) next »