From d95859d1bcb5ffcdcfab13621286709c935fad4b Mon Sep 17 00:00:00 2001 From: Sami Puro Date: Sat, 24 Oct 2026 17:09:03 +0300 Subject: [PATCH] Fix. Patch. utf8_decode() polyfill turned non-ASCII characters into NUL bytes --- lib/cleantalk-php-patch.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/cleantalk-php-patch.php b/lib/cleantalk-php-patch.php index 62f932d..6e90ab1 100644 --- a/lib/cleantalk-php-patch.php +++ b/lib/cleantalk-php-patch.php @@ -56,18 +56,18 @@ function utf8_decode($string) $stringlength = strlen($string); while ($offset < $stringlength) { if ((ord($string[$offset]) | 0x07) == 0xF7) { - $charval = ((ord($string[($offset + 0)]) & 0x07) << 18) & - ((ord($string[($offset + 1)]) & 0x3F) << 12) & - ((ord($string[($offset + 2)]) & 0x3F) << 6) & + $charval = ((ord($string[($offset + 0)]) & 0x07) << 18) | + ((ord($string[($offset + 1)]) & 0x3F) << 12) | + ((ord($string[($offset + 2)]) & 0x3F) << 6) | (ord($string[($offset + 3)]) & 0x3F); $offset += 4; } elseif ((ord($string[$offset]) | 0x0F) == 0xEF) { - $charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) & - ((ord($string[($offset + 1)]) & 0x3F) << 6) & + $charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) | + ((ord($string[($offset + 1)]) & 0x3F) << 6) | (ord($string[($offset + 2)]) & 0x3F); $offset += 3; } elseif ((ord($string[$offset]) | 0x1F) == 0xDF) { - $charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) & + $charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) | (ord($string[($offset + 1)]) & 0x3F); $offset += 2; } elseif ((ord($string[$offset]) | 0x7F) == 0x7F) {