From 2c7689a43d75bcd53d098357c21effdb1ea758a2 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Sun, 24 Apr 2022 18:51:59 +0200 Subject: [PATCH] fatal_error now accept extra parameter for error message formating --- includes/smarty.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/includes/smarty.php b/includes/smarty.php index 0fd112e..e076990 100644 --- a/includes/smarty.php +++ b/includes/smarty.php @@ -194,6 +194,14 @@ $ajax=false; function fatal_error($error) { global $smarty, $ajax, $api_mode; + // If more than one arguments passed, format error message using sprintf + if (func_num_args() > 1) { + $error = call_user_func_array( + 'sprintf', + array_merge(array($error), array_slice(func_get_args(), 1)) + ); + } + if (php_sapi_name() == "cli") die("FATAL ERROR : $error\n");