From 78dd8e2ef331563597da605004789fdf54fd6005 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Thu, 18 Jun 2020 07:52:44 +0200 Subject: [PATCH] Array and string offset access syntax with curly braces Fixed: "PHP Deprecated: Array and string offset access syntax with curly braces is deprecated" for php7.4 --- app/code/core/Mage/Eav/Model/Entity/Increment/Alphanum.php | 2 +- app/code/core/Mage/Eav/Model/Entity/Setup.php | 4 ++-- lib/Net/IDNA2.php | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/core/Mage/Eav/Model/Entity/Increment/Alphanum.php b/app/code/core/Mage/Eav/Model/Entity/Increment/Alphanum.php index d91b0c5eebc..e5693789914 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Increment/Alphanum.php +++ b/app/code/core/Mage/Eav/Model/Entity/Increment/Alphanum.php @@ -77,7 +77,7 @@ public function getNextId() $p = 0; $bumpNextChar = true; } - $nextId = $chars{$p}.$nextId; + $nextId = $chars[$p].$nextId; } return $this->format($nextId); diff --git a/app/code/core/Mage/Eav/Model/Entity/Setup.php b/app/code/core/Mage/Eav/Model/Entity/Setup.php index e05335a6d8a..6785e527234 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Setup.php +++ b/app/code/core/Mage/Eav/Model/Entity/Setup.php @@ -1231,14 +1231,14 @@ public function installEntities($entities = null) if (!empty($attr['frontend'])) { if ('_' === $attr['frontend']) { $attr['frontend'] = $frontendPrefix; - } elseif ('_' === $attr['frontend']{0}) { + } elseif (strpos($attr['frontend'], '_') === 0) { $attr['frontend'] = $frontendPrefix.$attr['frontend']; } } if (!empty($attr['source'])) { if ('_' === $attr['source']) { $attr['source'] = $sourcePrefix; - } elseif ('_' === $attr['source']{0}) { + } elseif (strpos($attr['source'], '_') === 0) { $attr['source'] = $sourcePrefix . $attr['source']; } } diff --git a/lib/Net/IDNA2.php b/lib/Net/IDNA2.php index 04cbeba6fde..2e69185538e 100644 --- a/lib/Net/IDNA2.php +++ b/lib/Net/IDNA2.php @@ -2700,7 +2700,7 @@ private 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->_decodeDigit($encoded{$enco_idx++}); + $digit = $this->_decodeDigit($encoded[$enco_idx++]); $idx += $digit * $w; $t = ($k <= $bias) ? @@ -3112,7 +3112,7 @@ private 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($input[$k]); // Extract byte from input string if ($v < 128) { // We found an ASCII char - put into stirng as is $output[$out_len] = $v; @@ -3279,7 +3279,7 @@ private 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($input[$i]) << (8 * (3 - ($i % 4) ) ); } return $output; }