smarty: fix handling extra parameters in add_error() & add_message()

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

View file

@ -86,7 +86,7 @@ if (!isset($_SESSION['errors']))
$_SESSION['errors']=array(); $_SESSION['errors']=array();
function add_error($error) { function add_error($error) {
// If more than one arguments passed, format error message using sprintf // If more than one arguments passed, format error message using sprintf
if (func_num_args() > 2) { if (func_num_args() > 1) {
$error = call_user_func_array( $error = call_user_func_array(
'sprintf', 'sprintf',
array_merge(array($error), array_slice(func_get_args(), 1)) array_merge(array($error), array_slice(func_get_args(), 1))
@ -99,7 +99,7 @@ if (!isset($_SESSION['messages']))
$_SESSION['messages']=array(); $_SESSION['messages']=array();
function add_message($message) { function add_message($message) {
// If more than one arguments passed, format message using sprintf // If more than one arguments passed, format message using sprintf
if (func_num_args() > 2) { if (func_num_args() > 1) {
$message = call_user_func_array( $message = call_user_func_array(
'sprintf', 'sprintf',
array_merge(array($message), array_slice(func_get_args(), 1)) array_merge(array($message), array_slice(func_get_args(), 1))