Encoding = 'utf-8'; $this->ShowError = false; $this->UserErrors = E_ALL; //E_ERROR | E_WARNING | E_PARSE; $this->OnError = array(array($this, 'ShowDefaultError')); } function Start() { set_error_handler(array($this, 'ErrorHandler')); set_exception_handler(array($this, 'ExceptionHandler')); } function Stop() { restore_error_handler(); restore_exception_handler(); } function ErrorHandler($Number, $Message, $FileName, $LineNumber, $Variables) { $ErrorType = array ( 1 => 'Error', 2 => 'Warning', 4 => 'Parsing Error', 8 => 'Notice', 16 => 'Core Error', 32 => 'Core Warning', 64 => 'Compile Error', 128 => 'Compile Warning', 256 => 'User Error', 512 => 'User Warning', 1024 => 'User Notice' ); if (($this->UserErrors & $Number)) { // Error was suppressed with the @-operator if (0 === error_reporting()) { return false; } $Backtrace = debug_backtrace(); $Backtrace[0]['function'] = $Message; $Backtrace[0]['args'] = ''; $Backtrace[0]['file'] = $FileName; $Backtrace[0]['line'] = $LineNumber; $this->Report($Backtrace); //if ((E_ERROR | E_PARSE) & $Number) die(); } } function ExceptionHandler(Throwable $Exception) { $Backtrace = $Exception->getTrace(); array_unshift($Backtrace, array( 'function' => $Exception->getMessage(), 'file' => $Exception->getFile(), 'line' => $Exception->getLine(), )); $this->Report($Backtrace); die(); } function ShowDefaultError(string $Message): void { $Output = '
'."\n". ''."\n". ''."\n". 'An internal error occurred!'.$Message.'