From 70b4ead012176cd4deb43c4a587d234bdb71541c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 28 Jan 2025 13:57:07 +0100 Subject: [PATCH] Fix protection translate with bad % --- htdocs/core/class/translate.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 688be96d260..1151ec349cc 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -699,7 +699,7 @@ class Translate $str ); - $str = preg_replace('/([^%])%([^%0sdmYIMpHSBb])/', '\1__percent_parenthesis__\2', $str); + $str = preg_replace('/([^%])%([^%0sdmYIMpHSBb])/', '\1__percent_with_bad_specifier__\2', $str); if (strpos($key, 'Format') !== 0) { try { @@ -710,7 +710,7 @@ class Translate } } - $str = str_replace('__percent_parenthesis__', '%)', $str); + $str = str_replace('__percent_with_bad_specifier__', '%', $str); // Encode string into HTML $str = htmlentities($str, ENT_COMPAT, $this->charset_output); // Do not convert simple quotes in translation (strings in html are embraced by "). Use dol_escape_htmltag around text in HTML content