From e558a8378391999d3e3e9fc877e9a841662e3a59 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 13 Oct 2023 21:55:15 +0000 Subject: [PATCH] Improved Emoji detection --- src/Content/Smilies.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Content/Smilies.php b/src/Content/Smilies.php index 7d3e4073f..2e1a6cf19 100644 --- a/src/Content/Smilies.php +++ b/src/Content/Smilies.php @@ -287,7 +287,7 @@ class Smilies } /** - * Checks if the body only contains 4 byte unicode characters. + * Checks if the body doesn't contain any alphanumeric characters * * @param string $body Possibly-HTML post body * @return boolean @@ -308,7 +308,7 @@ class Smilies for ($i = 0; $i < mb_strlen($conv); $i++) { $character = mb_substr($conv, $i, 1); - if (\IntlChar::isalnum($character)) { + if (\IntlChar::isalnum($character) || \IntlChar::ispunct($character) || \IntlChar::isgraph($character) && (strlen($character) <= 2)) { return false; } }