Deprecated string offset in Net_IDNA2 (PHP 7.4)
authorAlexander Ebert <ebert@woltlab.com>
Mon, 27 Jan 2020 15:32:16 +0000 (16:32 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 21 Oct 2020 10:14:30 +0000 (12:14 +0200)
(cherry picked from commit f1d17510cf7d5aa224ad10936ba4529990de127e)

wcfsetup/install/files/lib/system/api/pear/net_idna2/Net/IDNA2.php

index c56791cb32814103cbc312b7b3607f4fcc14e9d5..9640006f5c8d496123069f595953101a88a1842e 100644 (file)
@@ -2683,7 +2683,7 @@ class Net_IDNA2
 
         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($encoded[$k]);
             }
         } else {
             $decoded = array();
@@ -2700,7 +2700,7 @@ class Net_IDNA2
 
         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->_decodeDigit($encoded{$enco_idx++});
+                $digit = $this->_decodeDigit($encoded[$enco_idx++]);
                 $idx += $digit * $w;
 
                 $t = ($k <= $bias) ?
@@ -3112,7 +3112,7 @@ class Net_IDNA2
         $mode = 'next';
         $test = 'none';
         for ($k = 0; $k < $inp_len; ++$k) {
-            $v = ord($input{$k}); // Extract byte from input string
+            $v = ord($input[$k]); // Extract byte from input string
 
             if ($v < 128) { // We found an ASCII char - put into string as is
                 $output[$out_len] = $v;
@@ -3279,7 +3279,7 @@ class Net_IDNA2
                 $out_len++;
                 $output[$out_len] = 0;
             }
-            $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) );
+            $output[$out_len] += ord($input[$i]) << (8 * (3 - ($i % 4) ) );
         }
         return $output;
     }