From 1c0f4a5ae9060201dd533f0773f386f786b4af87 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Fri, 27 Jun 2025 17:17:06 -0400 Subject: [PATCH] Try to register fatal errors in file --- cli/bin/index.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cli/bin/index.php b/cli/bin/index.php index 9e47d85..d44635e 100644 --- a/cli/bin/index.php +++ b/cli/bin/index.php @@ -11,3 +11,12 @@ try { } catch (Exception $exception) { $app->getContainer()->get(Psr\Log\LoggerInterface::class)->notice($exception); } +register_shutdown_function(function() { + $error = error_get_last(); + + $fatal_errors = [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR]; + if ($error !== null and in_array($error['type'], $fatal_errors, true)) { + error_log(json_encode($error).PHP_EOL,3, '/logs/fatal.log'); + } + error_clear_last(); +});