diff --git a/index.php b/index.php index 1cc8e2c0..da60c279 100644 --- a/index.php +++ b/index.php @@ -94,11 +94,13 @@ try { if (function_exists("fastcgi_finish_request")) { fastcgi_finish_request(); } + $exit_code = 0; } catch (\Exception $e) { if ($database && $database->is_transaction_open()) { $database->rollback(); } _fatal_error($e); + $exit_code = 1; } finally { $_tracer->end(); if (TRACE_FILE) { @@ -114,3 +116,6 @@ try { } } } +if (PHP_SAPI === 'cli' || PHP_SAPI == 'phpdbg') { + exit($exit_code); +} \ No newline at end of file