Error handler.

@param  int        $num
@param  string     $str
@param  string     $file
@param  int        $line
@param  array|null $context

@return bool
185041
public function on_error( $num, $str, $file, $line, $context = NULL ) {

		$log_context = [];
		if ( $context ) {
			$skip_keys   = array_merge( array_keys( $GLOBALS ), self::$super_globals_keys );
			$skip        = array_fill_keys( $skip_keys, '' );
			$log_context = array_filter( array_diff_key( (array) $context, $skip ) );
		}

		$log_context[ 'file' ] = $file;
		$log_context[ 'line' ] = $line;

		// Log the PHP error.
		do_action(
			\Inpsyde\Wonolog\LOG,
			new Log( $str, self::$errors_level_map[ $num ], Channels::PHP_ERROR, $log_context )
		);

		return FALSE;
	}
1299898
public function handleError($errNumber, $errString, $errFile ='', $errLine = 0)
	{
		$interfaceSettings = $this->cmd->getConfigOpt('interface');
		$textColor = $interfaceSettings['error']['text_color'];
		$textBgColor = $interfaceSettings['error']['text_background'];

		$this->env->sendOutput('Error: ' . $errString, $textColor, $textBgColor);
		exit;
	}
526190
static public function errorHandler($errorNumber, $errorString, $errorFile, $errorLine)
    {

        /*
         * Is line has been suppressed with an @, do not throw an exception
         */
        if (error_reporting() == 0) {
            return;
        }

        $errorFullText = self::formatErrorText($errorNumber, $errorString, $errorFile, $errorLine);

        /*
     * Hold execution
     */
        if (self::$errorHoldsExecution) {
            throw new DebugException ($errorFullText, $errorNumber);
        } else {
            /*
     * display error
     */
            if (self::$displayErrors) {
                echo self::displayBox();
            }
            /*
       * Message error
       */
            if (self::$displayTrace) {
                echo self::formatError($errorFullText);
            }

            /*
     * Send message do psHelpdesk
     */
            if (self::$sendTrace) {
                self::send($errorFullText);
            }
        }

    }
1082792
public function errorHandler($code, $message, $file, $line)
    {
        switch ($code) {
            case E_NOTICE:
            case E_USER_NOTICE:
                $exception = new Errors\Notice($message, $code, 1, $file, $line);
                break;
            case E_WARNING:
            case E_USER_WARNING:
                $exception = new Errors\Warning($message, $code, 1, $file, $line);
                break;
            case E_ERROR:
            case E_CORE_ERROR:
            case E_RECOVERABLE_ERROR:
            case E_USER_ERROR:
                $exception = new Errors\Fatal($message, $code, 1, $file, $line);
                break;
            default:
                $exception = new Errors\Error($message, $code, 1, $file, $line);
                break;
        }

        $this->exceptionHandler($exception);

        if ($this->oldErrorHandler) {
            return call_user_func(
                $this->oldErrorHandler,
                $code,
                $message,
                $file,
                $line
            );
        }

        return false;
    }
224286
public static function report_php_error($errno, $errstr, $errfile, $errline)
    {
        self::$errorHandler->handle($errno, $errstr, $errfile, $errline);
        return false;
    }
954767
function onError(int $code, string $message, ?string $file = null, ?int $line = null): bool
    {
        $this->lastError = error_get_last();
        $this->currentErrorException = new ErrorException(
            $message,
            $code,
            ($code & error_reporting()) === 0,
            $file ?? __FILE__,
            $line ?? __LINE__
        );

        try {
            try {
                $this->emit(ErrorHandlerEvents::ERROR, $this->currentErrorException, $this->debug);
            } catch (\Throwable $e) {
                throw new ChainedException(
                    'Additional exception was thrown from an [error] event listener. See previous exceptions.',
                    0,
                    Exception::joinChains($this->currentErrorException, $e)
                );
            }

            // check suppression state
            if (!$this->currentErrorException->isSuppressed()) {
                throw $this->currentErrorException;
            }

            // suppressed error
            return true;
        } finally {
            $this->currentErrorException = null;
        }
    }
773150
public function errorHandler($type, $message, $file, $line)
    {
        $this->log(
        	'ErrorHandler: '
            . implode(' ', array($type, $message, $file, $line))
        );
    }
1238370
public function handleError($type, $message, $file, $line, $context)
    {
        if ($this->errorReporting() & $type) {
            $error = new \ErrorException($message, 0, $type, $file, $line);

            if ($this->convertFatalErrors && ($type & (E_RECOVERABLE_ERROR | E_USER_ERROR))) {
                throw $error;
            }

            if ($this->getLoggedErrorTypes() & $type) {
                $this->log($error);
            }
        }
        
        return $this->chainedErrorHandler
            ? call_user_func($this->chainedErrorHandler, $type, $message, $file, $line, $context)
            : false;
    }
1180693
public function errorHandler($errno, $errstr, $errfile, $errline)
        {
            $errorMsg = $errstr . " (Line: " . $errline . ")";

            if ($errno != E_WARNING && $errno != E_NOTICE && $errno != E_STRICT) {
                throw new Exception($errorMsg, $errno);
            } else {
                return false; // Let PHP handle it
            }
        }
782
public function handleError()
    {
        // get error info
        list ($errno, $message, $file, $line) = func_get_args();

        // construct error message
        $msg = "ERROR ($errno): $message";
        if ($line !== null) {
            $file = "$file:$line";
        }

        if ($file !== null) {
            $msg .= " [$file]";
        }

        static::$lastErrno = $errno;

        // throw the exception
        throw new RuntimeException($msg, $errno);
    }
202941
public static function error_handler( $errno, $errstr, $errfile, $errline, $errcontext = null ) {
		// If ignoring E_USER_WARNING | E_USER_NOTICE, default.
		if ( ! ( error_reporting() & $errno ) ) {
			return false;
		}
		// If not in "wp-includes/update.php", default.
		$update_php = 'wp-includes/update.php';
		if ( 0 !== substr_compare( $errfile, $update_php, -strlen( $update_php ) ) ) {
			return false;
		}
		// Else assume it's in `wp_update_themes()` or `wp_update_plugins()` and just ignore it.
		return true;
	}
766318
public static function error_log($errn,$errstr,$file,$line,$context){
		LogMaster::log($errstr." at ".$file." line ".$line);
	}
485328
public function createRecoverableErrorAndCallHandler(
        IErrorHandler $handler,
        $number,
        $string,
        $file,
        $line
    ) {
        $error = new RecoverableError($number, $string, $file, $line);

        return $handler->handleRecoverableError($error);
    }
1220949
function onErrorHandle($errno, $errstr, $errfile, $errline)
    {
        $error = array(
            'message' => $errstr,
            'file' => $errfile,
            'line' => $errline,
        );
        $this->errorResponse($error);
    }
626181
public function error($errorNumber, $message, $file, $line, $context) {
        $errorReporting = error_reporting();
        $errorEnabled = (bool)($errorReporting & $errorNumber);

        // Ignore errors that are below the current error reporting level.
        if (!$errorEnabled) {
            return false;
        }

        $backtrace = debug_backtrace();
        throw new ErrorException($message, $errorNumber, $file, $line, $context, $backtrace);
    }
576276
function errorHandler( $errno, $errstr, $errfile, $errline )
    {
        if ( error_reporting() == 0 ) // @ error-control operator is used
            return;
        if ( !eZDebug::isDebugEnabled() )
            return;
        $str = "$errstr in $errfile on line $errline";
        if ( empty( $GLOBALS['eZDebugPHPErrorNames'] ) )
        {
            $GLOBALS['eZDebugPHPErrorNames'] =
                array( E_ERROR => 'E_ERROR',
                       E_PARSE => 'E_PARSE',
                       E_CORE_ERROR => 'E_CORE_ERROR',
                       E_COMPILE_ERROR => 'E_COMPILE_ERROR',
                       E_USER_ERROR => 'E_USER_ERROR',
                       E_WARNING => 'E_WARNING',
                       E_CORE_WARNING => 'E_CORE_WARNING',
                       E_COMPILE_WARNING => 'E_COMPILE_WARNING',
                       E_USER_WARNING => 'E_USER_WARNING',
                       E_NOTICE => 'E_NOTICE',
                       E_USER_NOTICE => 'E_USER_NOTICE',
                       E_STRICT => 'E_STRICT' );
            // Since PHP 5.2
            if ( defined('E_RECOVERABLE_ERROR') )
                $GLOBALS['eZDebugPHPErrorNames'][E_RECOVERABLE_ERROR] = 'E_RECOVERABLE_ERROR';
            // Since PHP 5.3
            if ( defined('E_DEPRECATED') )
                $GLOBALS['eZDebugPHPErrorNames'][E_DEPRECATED] = 'E_DEPRECATED';
            if ( defined('E_USER_DEPRECATED') )
                $GLOBALS['eZDebugPHPErrorNames'][E_USER_DEPRECATED] = 'E_USER_DEPRECATED';

        }
        $errname = "Unknown error code ($errno)";
        if ( isset( $GLOBALS['eZDebugPHPErrorNames'][$errno] ) )
        {
            $errname = $GLOBALS['eZDebugPHPErrorNames'][$errno];
        }
        switch ( $errname )
        {
            case 'E_ERROR':
            case 'E_PARSE':
            case 'E_CORE_ERROR':
            case 'E_COMPILE_ERROR':
            case 'E_USER_ERROR':
            case 'E_RECOVERABLE_ERROR':
            {
                $this->writeError( $str, 'PHP: ' . $errname );
            } break;

            case 'E_WARNING':
            case 'E_CORE_WARNING':
            case 'E_COMPILE_WARNING':
            case 'E_USER_WARNING':
            case 'E_DEPRECATED':
            case 'E_USER_DEPRECATED':
            {
                $this->writeWarning( $str, 'PHP: ' . $errname );
            } break;

            case 'E_NOTICE':
            case 'E_USER_NOTICE':
            {
                $this->writeNotice( $str, 'PHP: ' . $errname );
            } break;

            case 'E_STRICT':
            {
                return $this->writeStrict( $str, 'PHP: ' . $errname );
            } break;
            default:
            {
                 $this->writeError( $str, 'PHP: ' . $errname );
            } break;
        }
    }
25659
public static function ErrorHandlerHTML($e_no, string $e_str, string $e_file, string $e_line)
    {
        $e_str = strpos($e_str, ':::') === false ? ['', $e_str] : explode(':::', $e_str);

        if (IS_CLI || IS_AJAX_REQUEST) {
            echo self::getErrorTextByNumber($e_no) . "\n";

            if ($e_str[0] === 'sql') {
                echo 'SQL error<br>' . SQL::getLastError() . '<br>' . $e_str[1];
            } else {
                echo 'PHP error in file <strong>' . $e_file . ' : ' . $e_line . '</strong><br>"' . preg_replace('/\"([^"]+)\"/', '"<strong>\\1</strong>"', $e_str[1]) . '"';
                echo "\n" . 'Location: ' . $e_file . ':' . $e_line . "\n";

                echo 'Error: ' . $e_str[1] . "\n";

                self::outputDebugStackTable();

                return;
            }
        }

        echo '<html><head><title>Error</title><style>table {border-collapse:collapse}</style></head><body>
<fieldset><legend>Error ' . self::getErrorTextByNumber($e_no), '</legend><br><table width="100%"><tr><td valign="top">';

        if ($e_str[0] === 'sql') {
            echo 'SQL error<br>' . SQL::getLastError() . '<br>' . $e_str[1];
        } else {
            echo preg_replace('/\"([^"]+)\"/', '"<strong>\\1</strong>"', $e_str[1]) . '';
        }

        echo '<br><br>File <strong>' . $e_file . ' : ' . $e_line . '</strong> </td><td valign="top">';

        self::outputDebugStackTable();

        echo '<br>';

        self::printGlobalArraysParams();

        echo '</fieldset></body></html>';
    }