From 19a231ff4e5bce9e9fb24756e9acb6b91e0ac367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Mon, 6 Apr 2026 13:23:19 +0200 Subject: [PATCH] Fixed: - usage of `$foo{$ix}` is no longer possible, you need to explicitly use `substr()` instead --- idna_convert.class.php | 10 +++++----- transcode_wrapper.php | 6 ++---- uctc.php | 11 +++++------ 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/idna_convert.class.php b/idna_convert.class.php index ed32dc8..7362d0c 100644 --- a/idna_convert.class.php +++ b/idna_convert.class.php @@ -423,7 +423,7 @@ protected function _decode($encoded) $delim_pos = strrpos($encoded, '-'); if ($delim_pos > self::byteLength($this->_punycode_prefix)) { for ($k = self::byteLength($this->_punycode_prefix); $k < $delim_pos; ++$k) { - $decoded[] = ord($encoded{$k}); + $decoded[] = ord(substr($encoded, $k, 1)); } } $deco_len = count($decoded); @@ -437,7 +437,7 @@ protected function _decode($encoded) for ($enco_idx = ($delim_pos) ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) { for ($old_idx = $idx, $w = 1, $k = $this->_base; 1; $k += $this->_base) { - $digit = $this->_decode_digit($encoded{$enco_idx++}); + $digit = $this->_decode_digit(substr($encoded, $enco_idx++, 1)); $idx += $digit * $w; $t = ($k <= $bias) ? $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias)); @@ -864,7 +864,7 @@ protected function _utf8_to_ucs4($input) $mode = 'next'; $test = 'none'; for ($k = 0; $k < $inp_len; ++$k) { - $v = ord($input{$k}); // Extract byte from input string + $v = ord(substr($input, $k, 1)); // Extract byte from input string if ($v < 128) { // We found an ASCII char - put into stirng as is $output[$out_len] = $v; ++$out_len; @@ -995,7 +995,7 @@ protected function _ucs4_string_to_ucs4($input) $out_len++; $output[$out_len] = 0; } - $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) ); + $output[$out_len] += ord(substr($input, $i, 1)) << (8 * (3 - ($i % 4) ) ); } return $output; } @@ -3458,4 +3458,4 @@ public function singleton($params = array()) 0x361 => 234, 0x345 => 240 ) ); -} \ No newline at end of file +} diff --git a/transcode_wrapper.php b/transcode_wrapper.php index 6862e40..d56dc59 100644 --- a/transcode_wrapper.php +++ b/transcode_wrapper.php @@ -92,7 +92,7 @@ function map_w1252_iso8859_1($string = '') if ($string == '') return ''; $return = ''; for ($i = 0; $i < strlen($string); ++$i) { - $c = ord($string{$i}); + $c = ord(substr($string, $i, 1)); switch ($c) { case 129: $return .= chr(252); break; case 132: $return .= chr(228); break; @@ -119,7 +119,7 @@ function map_iso8859_1_w1252($string = '') if ($string == '') return ''; $return = ''; for ($i = 0; $i < strlen($string); ++$i) { - $c = ord($string{$i}); + $c = ord(substr($string, $i, 1)); switch ($c) { case 196: $return .= chr(142); break; case 214: $return .= chr(153); break; @@ -133,5 +133,3 @@ function map_iso8859_1_w1252($string = '') } return $return; } - -?> \ No newline at end of file diff --git a/uctc.php b/uctc.php index ea5e476..f2e8b4a 100644 --- a/uctc.php +++ b/uctc.php @@ -59,7 +59,7 @@ private static function utf8_ucs4array($input) $mode = 'next'; $test = 'none'; for ($k = 0; $k < $inp_len; ++$k) { - $v = ord($input{$k}); // Extract byte from input string + $v = ord(substr($input, $k, 1)); // Extract byte from input string if ($v < 128) { // We found an ASCII char - put into stirng as is $output[$out_len] = $v; @@ -176,7 +176,7 @@ private static function utf7_ucs4array($input, $sc = '+') $b64 = ''; for ($k = 0; $k < $inp_len; ++$k) { - $c = $input{$k}; + $c = substr($input, $k, 1); if (0 == ord($c)) continue; // Ignore zero bytes if ('b' == $mode) { // Sequence got terminated @@ -193,10 +193,10 @@ private static function utf7_ucs4array($input, $sc = '+') $tmp = substr($tmp, -1 * (strlen($tmp) % 2)); for ($i = 0; $i < strlen($tmp); $i++) { if ($i % 2) { - $output[$out_len] += ord($tmp{$i}); + $output[$out_len] += ord(substr($tmp, $i, 1)); $out_len++; } else { - $output[$out_len] = ord($tmp{$i}) << 8; + $output[$out_len] = ord(substr($tmp, $i, 1)) << 8; } } $mode = 'd'; @@ -292,9 +292,8 @@ private static function ucs4_ucs4array($input) $out_len++; $output[$out_len] = 0; } - $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) ); + $output[$out_len] += ord(substr($input, $i, 1)) << (8 * (3 - ($i % 4) ) ); } return $output; } } -?> \ No newline at end of file