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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux