From 3e15b10425f4d4af86734a1110d838511218134d Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 9 Sep 2025 15:28:52 +0200 Subject: [PATCH] Replace chr() by mb_chr() and remove the workaround --- program/lib/Roundcube/rcube_utils.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php index e38371704..86cba8287 100644 --- a/program/lib/Roundcube/rcube_utils.php +++ b/program/lib/Roundcube/rcube_utils.php @@ -724,14 +724,7 @@ class rcube_utils public static function xss_entity_decode(string $content): string { $callback = static function ($matches) { - $bytevalue = hexdec((string) $matches[1]); - // chr() only covers values between 0 and 255. The following 4 lines are from the former default behaviour - // to ensure that, which is now deprecated, so we now explicitly do the shifting here. - while ($bytevalue < 0) { - $bytevalue += 256; - } - $bytevalue %= 256; - return chr($bytevalue); + return strval(mb_chr(hexdec((string) $matches[1]))); }; $out = html_entity_decode(html_entity_decode($content));