isFatalError($last['type'])) { return; } $this->cleanOutputBuffer(); $file = (string)($last['file'] ?? 'unknown'); $line = (int)($last['line'] ?? 0); $error = new Error($last['message'] ?? 'Fatal error',0); try { $ehm = new ErrorKernel(); $ehm->handle($error, ['file' => $file, 'line' => $line]); } catch (\Throwable) { } exit(255); } private function cleanOutputBuffer(): void { try { while (ob_get_level() > 0) { @ob_end_clean(); } } catch (\Throwable) { // ignore } } private function isFatalError(?int $type = null): bool { return in_array($type ?? 0, self::FATAL_TYPES, true); } }