@@ -180,7 +180,7 @@ public static function catch(\Throwable $e): void
180180 $ message = Lang::$ txt [$ e ->getMessage ()] ?? $ e ->getMessage ();
181181
182182 if (!empty (Config::$ modSettings ['enableErrorLogging ' ])) {
183- self ::log ($ message , 'general ' , $ e ->getFile (), $ e ->getLine ());
183+ self ::log ($ message , 'general ' , $ e ->getFile (), $ e ->getLine (), $ e -> getTrace () );
184184 }
185185
186186 self ::fatal ($ message , false );
@@ -200,7 +200,7 @@ public static function catch(\Throwable $e): void
200200 * @param int $line The line where the error occurred.
201201 * @return string The message that was logged.
202202 */
203- public static function log (string $ error_message , string |bool $ error_type = 'general ' , string $ file = '' , int $ line = 0 ): string
203+ public static function log (string $ error_message , string |bool $ error_type = 'general ' , string $ file = '' , int $ line = 0 , ? array $ backtrace = null ): string
204204 {
205205 static $ last_error ;
206206 static $ tried_hook = false ;
@@ -210,10 +210,10 @@ public static function log(string $error_message, string|bool $error_type = 'gen
210210
211211 // Collect a backtrace
212212 if (!isset (Config::$ db_show_debug ) || Config::$ db_show_debug === false ) {
213- $ backtrace = debug_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS );
213+ $ backtrace = $ backtrace ?? debug_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS );
214214 } else {
215215 // This is how to keep the args but skip the objects.
216- $ backtrace = debug_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS & DEBUG_BACKTRACE_PROVIDE_OBJECT );
216+ $ backtrace = $ backtrace ?? debug_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS & DEBUG_BACKTRACE_PROVIDE_OBJECT );
217217 }
218218
219219 // Are we in a loop?
0 commit comments