From ca35eda1da0214d82fa8f21d5991f5e784dc14c0 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 17 Jan 2023 21:04:33 +0900 Subject: [PATCH 1/2] Fix #2068 type error in utf8_clean() --- common/functions.php | 1 + 1 file changed, 1 insertion(+) diff --git a/common/functions.php b/common/functions.php index 60b8bef90..7aa79e052 100644 --- a/common/functions.php +++ b/common/functions.php @@ -623,6 +623,7 @@ function utf8_check($str) function utf8_clean($str) { // Check if the input is a valid UTF-8 string. + $str = (string)$str; if (!utf8_check($str)) { $str = @iconv('UTF-8', 'UTF-8//IGNORE', $str); From e1a3961973e8ba1a35f1c871a762b31742061e3a Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 17 Jan 2023 21:04:51 +0900 Subject: [PATCH 2/2] Fix mixing tabs and spaces --- common/functions.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/functions.php b/common/functions.php index 7aa79e052..39a69f0b4 100644 --- a/common/functions.php +++ b/common/functions.php @@ -624,9 +624,9 @@ function utf8_clean($str) { // Check if the input is a valid UTF-8 string. $str = (string)$str; - if (!utf8_check($str)) - { - $str = @iconv('UTF-8', 'UTF-8//IGNORE', $str); + if (!utf8_check($str)) + { + $str = @iconv('UTF-8', 'UTF-8//IGNORE', $str); } // Normalize the text content. @@ -643,8 +643,8 @@ function utf8_clean($str) // Remove excessively long sequences (more than 3) of combining diacritical marks. $str = preg_replace('/(\pM{3})\pM+/u', '$1', $str); - - return $str; + + return $str; } /** @@ -741,10 +741,10 @@ function is_empty_html_content($str) **/ if (!function_exists('is_countable')) { - function is_countable($var) + function is_countable($var) { - return is_array($var) || $var instanceof Countable; - } + return is_array($var) || $var instanceof Countable; + } } /**