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.