Bug #75586 [Opn->Fbk]: WSDL parsing issue throws a fatal error instead of a SOAPFault exception
| From: | nikic@php.net | Date: | Tue, 28 Nov 2017 21:41:43 +0000 |
| Subject: | Bug #75586 [Opn->Fbk]: WSDL parsing issue throws a fatal error instead of a SOAPFault exception | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-212782@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75586&edit=1
ID: 75586
Updated by: nikic@php.net
Reported by: ryan dot jentzsch at gmail dot com
Summary: WSDL parsing issue throws a fatal error instead of a
SOAPFault exception
-Status: Open
+Status: Feedback
Type: Bug
Package: SOAP related
Operating System: Linux Mint 18.3
PHP Version: 7.1.12
Block user comment: N
Private report: N
New Comment:
I can't reproduce this issue: The exception object is successfully dumped.
Please check whether your code works under php -n, and if it does, try to identify which extension
is responsible for the behavior. My guess would be that the xdebug error handler interferes here.
Previous Comments:
------------------------------------------------------------------------
[2017-11-28 21:33:04] ryan dot jentzsch at gmail dot com
Description:
------------
Subclassing the SoapClient class and wrapping the call to the parent constructor will throw a fatal
error even when wrapped in a try...catch(\Throwable $t).
With PHP 7 try...catch(\Throwable $t) being a convenient method of adding fault tolerance and
graceful degradation -- it is therefore very frustrating when a WSDL PARSE issue is encountered that
an UNCATCHABLE script exiting fatal error is issued.
Related: 60780, 45093, (XDEBUG specific: 34657, 49587)
SO "work-around": https://stackoverflow.com/questions/6952814/php-soap-error-catching
Test script:
---------------
<?php
class SoapAgent extends \SoapClient
{
public function __construct(string $wsdl)
{
try {
parent::__construct($wsdl);
echo 'Success!' . PHP_EOL;
} catch (\Throwable $t) {
var_dump($t);
}
}
}
$client = new SoapAgent('bogus');
Expected result:
----------------
var_dump() of the Throwable object.
Actual result:
--------------
Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'bogus' : failed to load
external entity "bogus"
Process finished with exit code 255
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75586&edit=1