public function handleError($errno, $errstr, $errfile, $errline)
  {
    if (error_reporting()===0)
    {
      // Error was suppressed with the @-operator. Don't throw an exception.
      return false;
    }

    $exception = new ErrorException($errstr, $errno, $errno, $errfile, $errline);

    // In case error appeared in __toString method we can't throw any exception.
    $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
    array_shift($trace);
    foreach ($trace as $frame)
    {
      if ($frame['function']==='__toString')
      {
        $this->handleException($exception);

        exit(1);
      }
    }

    throw $exception;
  }
public function handleError($errno, $errstr, $errfile, $errline)
  {
    if (error_reporting()===0)
    {
      // Error was suppressed with the @-operator. Don't throw an exception.
      return false;
    }

    $exception = new ErrorException($errstr, $errno, $errno, $errfile, $errline);

    // In case error appeared in __toString method we can't throw any exception.
    $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
    array_shift($trace);
    foreach ($trace as $frame)
    {
      if ($frame['function']==='__toString')
      {
        $this->handleException($exception);

        exit(1);
      }
    }

    throw $exception;
  }
public function handleError ( $ errno , $ errstr , $ errfile , $ errline ) { if ( error_reporting ( ) === 0 ) { // Error was suppressed with the @-operator. Don't throw an exception. return false ; } $ exception = new ErrorException ( $ errstr , $ errno , $ errno , $ errfile , $ errline ) ; // In case error appeared in __toString method we can't throw any exception. $ trace = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS ) ; array_shift ( $ trace ) ; foreach ( $ trace as $ frame ) { if ( $ frame [ 'function' ] === '__toString' ) { $ this -> handleException ( $ exception ) ; exit ( 1 ) ; } } throw $ exception ; }
An error handler function that throws exceptions.

@param int    $errno   The level of the error raised.
@param string $errstr  The error message.
@param string $errfile The filename that the error was raised in.
@param string $errline The line number the error was raised at.

@return bool

See http://php.net/manual/en/function.set-error-handler.php.

@throws ErrorException
An error handler function that throws exceptions .