From 18a6904d5d555ef348151e6d7cdfe4adb254ccdc Mon Sep 17 00:00:00 2001 From: onli Date: Wed, 30 Jun 2021 21:39:42 +0200 Subject: [PATCH] Fix: Serendipity stopped when encountering a Warning Changes this to only stopping if debug mode is enabled --- include/compat.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/compat.inc.php b/include/compat.inc.php index a22b809e..eda95f9e 100644 --- a/include/compat.inc.php +++ b/include/compat.inc.php @@ -207,7 +207,11 @@ if (!function_exists('errorToExceptionHandler')) { echo '

' . $type . ': '.$errStr . ' in ' . $errFile . ' on line ' . $errLine . '.' . $debug_note . '

'; echo '
';
-            throw new \ErrorException($type . ': ' . $errStr, 0, $errNo, $errFile, $errLine); // tracepath = all, if not ini_set('display_errors', 0);
+            
+            if ($serendipity['production'] === 'debug') {
+                // In debug mode, throwing an exception here will stop the code execution. Sometimes useful to catch all errors.
+                throw new \ErrorException($type . ': ' . $errStr, 0, $errNo, $errFile, $errLine);
+            }
 
             if (!$serendipity['dbConn'] || $exit) {
                 exit; // make sure to exit in case of database connection errors or fatal errors.