php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77601 WSDL parsing issue throws a fatal error instead of a SOAPFault exception
Submitted: 2019-02-11 09:26 UTC Modified: 2019-02-12 08:42 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: nikstar at ukr dot net Assigned: derick (profile)
Status: Wont fix Package: SOAP related
PHP Version: 7.3.2 OS: Windows 7
Private report: No CVE-ID: None
 [2019-02-11 09:26 UTC] nikstar at ukr dot net
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.3.2 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.

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('test');

Expected result:
----------------
var_dump() of the Throwable object.

Actual result:
--------------
Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'test' : failed to load external entity "test"

Process finished with exit code 255

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-02-11 09:44 UTC] nikic@php.net
-Status: Open +Status: Feedback
 [2019-02-11 09:44 UTC] nikic@php.net
I can't reproduce this. I know this used to be an issue, but was fixed in bug 
#70469. Are you sure that this is on PHP 7.3.2 and not some older version also installed on your system? Can you check if it works with php -n (-n meaning no ini file)?
 [2019-02-11 10:06 UTC] nikstar at ukr dot net
This bug is reproducing in PHP 7.3.2 with enabled Xdebug extension. 
With disabled Xdebug - bug not reproduce.
 [2019-02-11 10:26 UTC] nikic@php.net
-Status: Feedback +Status: Open -Assigned To: +Assigned To: derick
 [2019-02-11 10:26 UTC] nikic@php.net
@derick: Is there anything that can be done about this on the xdebug side? ext/soap has some horrible error handling where it throws fatal errors all over the place and uses a custom error handler to convert them to exceptions and bail out (soap_error_handler). I think the interaction with xdebug might be because xdebug ends up wrapping the soap handler, rather than soap the xdebug handler.
 [2019-02-12 08:33 UTC] nikstar at ukr dot net
This bug was fixed by @derick on the xdebug side. 
https://bugs.xdebug.org/view.php?id=1629

Thank you!
 [2019-02-12 08:42 UTC] nikic@php.net
-Status: Assigned +Status: Wont fix
 [2019-02-12 08:42 UTC] nikic@php.net
Great, marking it as Won't Fix here then. It would be nice to refactor the whole SOAP implementation, but I kind of doubt someone will actually do it...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 08:01:28 2024 UTC