} }); register_shutdown_function(function () { $exception = error_get_last(); if ($exception) { $message = isAke($exception, 'message', 'NA'); $type = isAke($exception, 'type', 1); $line = isAke($exception, 'line', 1); $file = isAke($exception, 'file'); $exception = new \ErrorException($message, $type, 0, $file, $line); $typeError = Arrays::in($type, [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE]) ? 'FATAL ERROR' : 'ERROR'; if (fnmatch('*Allowed memory size*', $message)) { dd($file . '[' . $message . ']', 'Ligne:' . $line); } elseif (!fnmatch('*undefinedVariable*', $message) && !fnmatch('*connected*', $message) && file_exists($file)) { $start = $line > 5 ? $line - 5 : $line; $code = File::readLines($file, $start, $line + 5); $lines = explode("\n", $code); $codeLines = []; $i = $start; foreach ($lines as $codeLine) { if ($i == $line) { array_push($codeLines, $i . '. <span style="background-color: gold; color: black;">' . $codeLine . '</span>'); } else { array_push($codeLines, $i . '. ' . $codeLine); } $i++; } wdd('<div style="text-align: center; padding: 5px; color: black; border: solid 1px black; background: #f2f2f2;">' . $typeError . '</div>', '<div style="padding: 5px; color: red; border: solid 1px red; background: #f2f2f2;">' . $message . '</div>', '<div style="padding: 5px; color: navy; border: solid 1px navy; background: #f2f2f2;">' . $file . ' [<em>line: <u>' . $line . '</u></em>]</div>', '<div style="font-family: Consolas; font-weight: 400; padding: 5px; color: green; border: solid 1px green; background: #f2f2f2;">' . implode("\n", $codeLines) . '</div>', '<div style="text-align: center; padding: 5px; color: black; border: solid 1px black; background: #f2f2f2;">BACKTRACE</div>', '<div style="padding: 5px; color: purple; border: solid 1px purple; background: #f2f2f2;">' . displayCodeLines() . '</div>'); } } });