fatal_error now accept extra parameter for error message formating

This commit is contained in:
Benjamin Renard 2022-04-24 18:51:59 +02:00
parent 6b20a4a526
commit 2c7689a43d

View file

@ -194,6 +194,14 @@ $ajax=false;
function fatal_error($error) { function fatal_error($error) {
global $smarty, $ajax, $api_mode; 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") if (php_sapi_name() == "cli")
die("FATAL ERROR : $error\n"); die("FATAL ERROR : $error\n");