Merge branch 'develop' into pr/whitespace

This commit is contained in:
Kijin Sung 2023-01-30 21:49:10 +09:00
commit 1ab8f3470f

View file

@ -623,9 +623,10 @@ function utf8_check($str)
function utf8_clean($str) function utf8_clean($str)
{ {
// Check if the input is a valid UTF-8 string. // Check if the input is a valid UTF-8 string.
if (!utf8_check($str)) $str = (string)$str;
{ if (!utf8_check($str))
$str = @iconv('UTF-8', 'UTF-8//IGNORE', $str); {
$str = @iconv('UTF-8', 'UTF-8//IGNORE', $str);
} }
// Normalize the text content. // Normalize the text content.
@ -643,7 +644,7 @@ function utf8_clean($str)
// Remove excessively long sequences (more than 3) of combining diacritical marks. // Remove excessively long sequences (more than 3) of combining diacritical marks.
$str = preg_replace('/(\pM{3})\pM+/u', '$1', $str); $str = preg_replace('/(\pM{3})\pM+/u', '$1', $str);
return $str; return $str;
} }
/** /**
@ -740,10 +741,10 @@ function is_empty_html_content($str)
**/ **/
if (!function_exists('is_countable')) 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;
} }
} }
/** /**