Skip to content

Commit 475c955

Browse files
authored
bugfix(zend) Deprecated: Array and string offset access syntax with curly braces is deprecated (#1343)
1 parent 2c2beb8 commit 475c955

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

lib/Zend/Json/Decoder.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ protected function _getNextToken()
324324
$i = $this->_offset;
325325
$start = $i;
326326

327-
switch ($str{$i}) {
327+
switch ($str[$i]) {
328328
case '{':
329329
$this->_token = self::LBRACE;
330330
break;
@@ -351,14 +351,14 @@ protected function _getNextToken()
351351
break;
352352
}
353353

354-
$chr = $str{$i};
354+
$chr = $str[$i];
355355

356356
if ($chr == '\\') {
357357
$i++;
358358
if ($i >= $str_length) {
359359
break;
360360
}
361-
$chr = $str{$i};
361+
$chr = $str[$i];
362362
switch ($chr) {
363363
case '"' :
364364
$result .= '"';
@@ -431,7 +431,7 @@ protected function _getNextToken()
431431
return($this->_token);
432432
}
433433

434-
$chr = $str{$i};
434+
$chr = $str[$i];
435435
if ($chr == '-' || $chr == '.' || ($chr >= '0' && $chr <= '9')) {
436436
if (preg_match('/-?([0-9])*(\.[0-9]*)?((e|E)((-|\+)?)[0-9]+)?/s',
437437
$str, $matches, PREG_OFFSET_CAPTURE, $start) && $matches[0][1] == $start) {
@@ -494,7 +494,7 @@ public static function decodeUnicodeString($chrs)
494494
$i += 5;
495495
break;
496496
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
497-
$utf8 .= $chrs{$i};
497+
$utf8 .= $chrs[$i];
498498
break;
499499
case ($ord_chrs_c & 0xE0) == 0xC0:
500500
// characters U-00000080 - U-000007FF, mask 110XXXXX
@@ -552,7 +552,7 @@ protected static function _utf162utf8($utf16)
552552
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
553553
}
554554

555-
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
555+
$bytes = (ord($utf16[0]) << 8) | ord($utf16[1]);
556556

557557
switch (true) {
558558
case ((0x7F & $bytes) == $bytes):

lib/Zend/Json/Encoder.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -558,17 +558,17 @@ protected static function _utf82utf16($utf8)
558558
case 2:
559559
// return a UTF-16 character from a 2-byte UTF-8 char
560560
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
561-
return chr(0x07 & (ord($utf8{0}) >> 2))
562-
. chr((0xC0 & (ord($utf8{0}) << 6))
563-
| (0x3F & ord($utf8{1})));
561+
return chr(0x07 & (ord($utf8[0]) >> 2))
562+
. chr((0xC0 & (ord($utf8[0]) << 6))
563+
| (0x3F & ord($utf8[1])));
564564

565565
case 3:
566566
// return a UTF-16 character from a 3-byte UTF-8 char
567567
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
568-
return chr((0xF0 & (ord($utf8{0}) << 4))
569-
| (0x0F & (ord($utf8{1}) >> 2)))
570-
. chr((0xC0 & (ord($utf8{1}) << 6))
571-
| (0x7F & ord($utf8{2})));
568+
return chr((0xF0 & (ord($utf8[0]) << 4))
569+
| (0x0F & (ord($utf8[1]) >> 2)))
570+
. chr((0xC0 & (ord($utf8[1]) << 6))
571+
| (0x7F & ord($utf8[2])));
572572
}
573573

574574
// ignoring UTF-32 for now, sorry

0 commit comments

Comments
 (0)