# SoapClient: Catchable Fatal Error for invalid WSDL

- Thread: https://externals.io/message/63300
- Original archive: https://news-web.php.net/php.internals/63300
- Started by Nicolai Scheer on 2012-10-09T11:34:26+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #63300 — Nicolai Scheer — 2012-10-09T11:34:26+00:00

URL: https://externals.io/message/63300#63300

Hi!

Just read the comments for Bug #47584: WSDL error in soapClient causes
Fatal Error.

If a SoapClient is created and the WSDL can not be found, an Exception
is thrown:

<?php

try
{
    $x = new SoapClient( "non-existent.wsdl", array( "exceptions" => 1 ) );
}
catch ( Exception $e )
{
    echo $e->faultstring;
}

echo "ok\n";

$error = `error_get_last()`;
print_r( $error );
?>

Although I'm using exceptions here, an `E_ERROR` gets "registered", thus
the output is:

SOAP-ERROR: Parsing WSDL: Couldn't load from 'non-existent.wsdl' :
failed to load external entity "non-existent.wsdl"
ok
Array
(
    [type] => 1
    [message] => SOAP-ERROR: Parsing WSDL: Couldn't load from
'non-existent.wsdl' : failed to load external entity
"non-existent.wsdl"

    [file] => Y:\client2.phb
    [line] => 5
)


Can anybody comment on this behaviour? Should an error be registered
when exceptions are used? Should this be an `E_RECOVERABLE_ERROR` 
instead?
The specific problem is that we use a shutdown function that utilizes
 `error_get_last()` to see if a fatal error orccured and then tries to
redirect to a specific error page.
Now we call a php script via ajax that tries to connect to a soap
service. If the service is unreachable we correctly catch the
exception, but the registered `E_ERROR` gets processed on shutdown, thus
redirecting...

Thanks and greetings

Nico
