From 9982bfce1f0ae2f9aa5a755787912089da145da8 Mon Sep 17 00:00:00 2001 From: Dag Date: Wed, 31 Jul 2024 17:51:44 +0200 Subject: [PATCH] fix: convert php errors to exceptions when in debug mode (#4176) --- index.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 7144ae27..f23d8441 100644 --- a/index.php +++ b/index.php @@ -25,8 +25,10 @@ set_error_handler(function ($code, $message, $file, $line) { // Deprecation messages and other masked errors are typically ignored here return false; } - // In the future, uncomment this: - //throw new \ErrorException($message, 0, $code, $file, $line); + if (Debug::isEnabled()) { + // This might be annoying, but it's for the greater good + throw new \ErrorException($message, 0, $code, $file, $line); + } $text = sprintf( '%s at %s line %s', sanitize_root($message),