From 0c815fc27bd68e9b261c7e7bff8192d82a84e0c1 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Wed, 4 Dec 2024 15:59:16 +0900 Subject: [PATCH] Fix incorrect return type of utf8_trim() if input string contains invalid UTF-8 sequence --- common/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/functions.php b/common/functions.php index d2b2d0d23..84147358d 100644 --- a/common/functions.php +++ b/common/functions.php @@ -692,7 +692,7 @@ function utf8_normalize_spaces($str, bool $multiline = false): string */ function utf8_trim($str): string { - return preg_replace('/^[\s\pZ\pC]+|[\s\pZ\pC]+$/u', '', (string)$str); + return preg_replace('/^[\s\pZ\pC]+|[\s\pZ\pC]+$/u', '', (string)$str) ?? ''; } /**