From e7071dd8c43a881831124f2155e33a769c2cb892 Mon Sep 17 00:00:00 2001 From: vmaury Date: Thu, 21 Dec 2023 19:17:39 +0100 Subject: [PATCH 1/3] Fix #27203 avoid ugly messages --- htdocs/core/lib/functions.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a1cb88fa60e..26fef322e06 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9022,7 +9022,8 @@ function setEventMessage($mesgs, $style = 'mesgs', $noduplicate = 0) { //dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); This is not deprecated, it is used by setEventMessages function if (!is_array($mesgs)) { - // If mesgs is a string + $mesgs = trim((string)$mesgs); + // If mesgs is a not an empty string if ($mesgs) { if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesgs, $_SESSION['dol_events'][$style])) { return; @@ -9032,6 +9033,7 @@ function setEventMessage($mesgs, $style = 'mesgs', $noduplicate = 0) } else { // If mesgs is an array foreach ($mesgs as $mesg) { + $mesg = trim((string)$mesg); if ($mesg) { if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesg, $_SESSION['dol_events'][$style])) { return; From b5d4b53597766a85d163294cd258c4bacda561c1 Mon Sep 17 00:00:00 2001 From: vmaury Date: Thu, 21 Dec 2023 19:23:12 +0100 Subject: [PATCH 2/3] Fix #27203 avoid ugly messages --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 26fef322e06..510c22a0af9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9022,7 +9022,7 @@ function setEventMessage($mesgs, $style = 'mesgs', $noduplicate = 0) { //dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); This is not deprecated, it is used by setEventMessages function if (!is_array($mesgs)) { - $mesgs = trim((string)$mesgs); + $mesgs = trim((string) $mesgs); // If mesgs is a not an empty string if ($mesgs) { if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesgs, $_SESSION['dol_events'][$style])) { @@ -9033,7 +9033,7 @@ function setEventMessage($mesgs, $style = 'mesgs', $noduplicate = 0) } else { // If mesgs is an array foreach ($mesgs as $mesg) { - $mesg = trim((string)$mesg); + $mesg = trim((string) $mesg); if ($mesg) { if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesg, $_SESSION['dol_events'][$style])) { return; From dc74eaa3fc5dce1022bf2357429b2aab32fc2110 Mon Sep 17 00:00:00 2001 From: vmaury Date: Thu, 21 Dec 2023 19:26:30 +0100 Subject: [PATCH 3/3] Fix #27203 avoid ugly messages --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 510c22a0af9..d4c586202e8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9023,7 +9023,7 @@ function setEventMessage($mesgs, $style = 'mesgs', $noduplicate = 0) //dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); This is not deprecated, it is used by setEventMessages function if (!is_array($mesgs)) { $mesgs = trim((string) $mesgs); - // If mesgs is a not an empty string + // If mesgs is a not an empty string if ($mesgs) { if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesgs, $_SESSION['dol_events'][$style])) { return;