severity of SOAP-ERROR: Parsing WSDL: Couldn't load from

From: Date: Tue, 05 Dec 2017 07:48:58 +0000
Subject: severity of SOAP-ERROR: Parsing WSDL: Couldn't load from
Groups: php.general 
Request: Send a blank email to php-general+get-326289@lists.php.net to get a copy of this message
Hello,  I've written a test function that tests availability of a soap service. If the service is not available, eg http 404 is returned, I get on php 7.1. 12, x64 win, ErrorException. The're two problems: 1. If xdebug used, FATAL ERROR is thrown. There must be done a workaround, see https://bugs.php.net/bug.php?id=47584, [2012-10-03 09:36 UTC] james dot silver at computerminds dot co dot uk Wouldn't be reasonable to decrease the severity to a normal Exception ? If you'd like to download a page from a url, the curl also returns error, not a php fatal error. 2. If you catch \Throwable $ex, the value of error_clear_last() remains still filled in with ErrorException("SOAP-ERROR Parsing WSDL ...") I must explicitly clear it by error_clear_last(); Shouldn't be the caught ErrorException implicitly cleared in catch block ? We're using Nette Tracy and in its shutdown handler the error_get_last() is inspected and Tracy shows the same error as was caught. Here is a stub of method how to call safely a ws without worrying about the script will be terminated unexpectedly:  try   {
      // @see https://bugs.php.net/bug.php?id=47584, [2012-10-03 09:36 UTC] james dot silver at computerminds dot co dot uk
      if (function_exists('xdebug_disable'))
      {
        xdebug_disable();
      }
      $ws = new SoapClient(.);
      $response = $ws->CheckVersion(.);
    }
    catch (\Throwable $ex)
    {
      //downgrade the severity to exception
      error_clear_last();
      throw new \Exception($ex->getMessage(), $ex->getCode());
    }
    finally
    {
      if (function_exists('xdebug_enable')) {
        xdebug_enable();
      }
  } Jan.

« previous php.general (#326289) next »