From c82851241bb4e09c13514e10504b1bb656e6f8b9 Mon Sep 17 00:00:00 2001 From: jim winstead Date: Thu, 16 Jan 2020 11:51:40 -0800 Subject: [PATCH] Fix very deprecated {} string references --- lib/cleantalk-php-patch.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/cleantalk-php-patch.php b/lib/cleantalk-php-patch.php index 470fa08..a6aa44c 100644 --- a/lib/cleantalk-php-patch.php +++ b/lib/cleantalk-php-patch.php @@ -49,23 +49,23 @@ function utf8_decode($string){ $offset = 0; $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) & - (ord($string{($offset + 3)}) & 0x3F); + 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) & + (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) & - (ord($string{($offset + 2)}) & 0x3F); + } elseif ((ord($string[$offset]) | 0x0F) == 0xEF) { + $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) & - (ord($string{($offset + 1)}) & 0x3F); + } elseif ((ord($string[$offset]) | 0x1F) == 0xDF) { + $charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) & + (ord($string[($offset + 1)]) & 0x3F); $offset += 2; - } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { - $charval = ord($string{$offset}); + } elseif ((ord($string[$offset]) | 0x7F) == 0x7F) { + $charval = ord($string[$offset]); $offset += 1; } else { $charval = false; @@ -77,4 +77,4 @@ function utf8_decode($string){ } return $newcharstring; } -} \ No newline at end of file +}