Edit report at https://bugs.php.net/bug.php?id=47584&edit=1
ID: 47584 Comment by: james dot silver at computerminds dot co dot uk Reported by: gem at rellim dot com Summary: WSDL error in soapClient causes Fatal Error Status: Not a bug Type: Bug Package: SOAP related Operating System: Linux PHP Version: 5.2.9 Assigned To: dmitry Block user comment: N Private report: N New Comment: The above solution(s) worked for me on an Ubuntu server, but not on IIS. My final solution added in a custom error handler which did the trick - e.g: <?php if (function_exists('xdebug_disable')) { xdebug_disable(); } set_error_handler('my_custom_soap_wsdl_error_handler'); new SoapClient('http://google.com', array('exceptions' => TRUE)); restore_error_handler(); if (function_exists('xdebug_enable')) { xdebug_enable(); } function my_custom_soap_wsdl_error_handler($errno, $errstr, $errfile = NULL, $errline = NULL, $errcontext = NULL) { // Simulate the exception that Soap *should* have thrown instead of an error. // This is needed to support certain IIS server setups it would seem. $wsdl_url = isset($errcontext['wsdl']) ? $errcontext['wsdl'] : ''; $msg = "SOAP-ERROR: Parsing WSDL: Couldn't load from '" . $wsdl_url . "' : failed to load external entity \"" . $wsdl_url . "\""; if (class_exists('SoapFault')) { $e = new SoapFault('WSDL', $msg); } else { $e = new Exception($msg, 0); } throw $e; } ?> Previous Comments: ------------------------------------------------------------------------ [2012-01-26 08:40:50] zpon dot dk at gmail dot com I had to surround my SoapClient call with xdebug_disable(); and xdebug_enable(); (@ was not enough) to work around this problem. ------------------------------------------------------------------------ [2010-09-02 21:10:09] gem at rellim dot com I was a confirmed bug in earlier versions. So it should be 'Fixed' not "Bogus'. ------------------------------------------------------------------------ [2010-09-02 19:37:13] ras...@php.net Right, so this is not a PHP bug. Perhaps a feature request to downgrade that particular error to a Warning instead of a catchable fatal, but that is all I see. ------------------------------------------------------------------------ [2010-09-02 19:34:19] gem at rellim dot com I do see it catchable now without XDebug. # php tmp.php SOAP-ERROR: Parsing WSDL: Couldn't load from 'non-existent.wsdl' : failed to load external entity "non-existent.wsdl" ok # ------------------------------------------------------------------------ [2010-09-02 19:33:05] gem at rellim dot com Not catchable for me with XDebug and your example: # cat tmp.php <?php try { $x = @new SoapClient("non-existent.wsdl",array("exceptions" => 1)); } catch (SoapFault $E) { echo $E->faultstring; } echo "ok\n"; ?> # php tmp.php # ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=47584 -- Edit this bug report at https://bugs.php.net/bug.php?id=47584&edit=1