vendor/Zend: Avoid curly braces to access array offsets

https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.core.array-string-access-curly-brace
This commit is contained in:
Johannes Meyer 2019-12-04 09:50:55 +01:00
parent 67dd439673
commit 0a44bbc804
4 changed files with 17 additions and 17 deletions

View File

@ -227,7 +227,7 @@ class Zend_Filter_Compress_Zip extends Zend_Filter_Compress_CompressAbstract
for ($i = 0; $i < $zip->numFiles; $i++) { for ($i = 0; $i < $zip->numFiles; $i++) {
$statIndex = $zip->statIndex($i); $statIndex = $zip->statIndex($i);
$currName = $statIndex['name']; $currName = $statIndex['name'];
if (($currName{0} == '/') || if (($currName[0] == '/') ||
(substr($currName, 0, 2) == '..') || (substr($currName, 0, 2) == '..') ||
(substr($currName, 0, 4) == './..') (substr($currName, 0, 4) == './..')
) )

View File

@ -317,7 +317,7 @@ class Zend_Json_Decoder
$i = $this->_offset; $i = $this->_offset;
$start = $i; $start = $i;
switch ($str{$i}) { switch ($str[$i]) {
case '{': case '{':
$this->_token = self::LBRACE; $this->_token = self::LBRACE;
break; break;
@ -344,14 +344,14 @@ class Zend_Json_Decoder
break; break;
} }
$chr = $str{$i}; $chr = $str[$i];
if ($chr == '\\') { if ($chr == '\\') {
$i++; $i++;
if ($i >= $str_length) { if ($i >= $str_length) {
break; break;
} }
$chr = $str{$i}; $chr = $str[$i];
switch ($chr) { switch ($chr) {
case '"' : case '"' :
$result .= '"'; $result .= '"';
@ -423,7 +423,7 @@ class Zend_Json_Decoder
return($this->_token); return($this->_token);
} }
$chr = $str{$i}; $chr = $str[$i];
if ($chr == '-' || $chr == '.' || ($chr >= '0' && $chr <= '9')) { if ($chr == '-' || $chr == '.' || ($chr >= '0' && $chr <= '9')) {
if (preg_match('/-?([0-9])*(\.[0-9]*)?((e|E)((-|\+)?)[0-9]+)?/s', if (preg_match('/-?([0-9])*(\.[0-9]*)?((e|E)((-|\+)?)[0-9]+)?/s',
$str, $matches, PREG_OFFSET_CAPTURE, $start) && $matches[0][1] == $start) { $str, $matches, PREG_OFFSET_CAPTURE, $start) && $matches[0][1] == $start) {
@ -483,7 +483,7 @@ class Zend_Json_Decoder
$i += 5; $i += 5;
break; break;
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
$utf8 .= $chrs{$i}; $utf8 .= $chrs[$i];
break; break;
case ($ord_chrs_c & 0xE0) == 0xC0: case ($ord_chrs_c & 0xE0) == 0xC0:
// characters U-00000080 - U-000007FF, mask 110XXXXX // characters U-00000080 - U-000007FF, mask 110XXXXX
@ -541,7 +541,7 @@ class Zend_Json_Decoder
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
} }
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); $bytes = (ord($utf16[0]) << 8) | ord($utf16[1]);
switch (true) { switch (true) {
case ((0x7F & $bytes) == $bytes): case ((0x7F & $bytes) == $bytes):

View File

@ -556,17 +556,17 @@ class Zend_Json_Encoder
case 2: case 2:
// return a UTF-16 character from a 2-byte UTF-8 char // return a UTF-16 character from a 2-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x07 & (ord($utf8{0}) >> 2)) return chr(0x07 & (ord($utf8[0]) >> 2))
. chr((0xC0 & (ord($utf8{0}) << 6)) . chr((0xC0 & (ord($utf8[0]) << 6))
| (0x3F & ord($utf8{1}))); | (0x3F & ord($utf8[1])));
case 3: case 3:
// return a UTF-16 character from a 3-byte UTF-8 char // return a UTF-16 character from a 3-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr((0xF0 & (ord($utf8{0}) << 4)) return chr((0xF0 & (ord($utf8[0]) << 4))
| (0x0F & (ord($utf8{1}) >> 2))) | (0x0F & (ord($utf8[1]) >> 2)))
. chr((0xC0 & (ord($utf8{1}) << 6)) . chr((0xC0 & (ord($utf8[1]) << 6))
| (0x7F & ord($utf8{2}))); | (0x7F & ord($utf8[2])));
} }
// ignoring UTF-32 for now, sorry // ignoring UTF-32 for now, sorry

View File

@ -165,7 +165,7 @@ class Zend_Validate_Isbn extends Zend_Validate_Abstract
$isbn10 = str_replace($this->_separator, '', $value); $isbn10 = str_replace($this->_separator, '', $value);
$sum = 0; $sum = 0;
for ($i = 0; $i < 9; $i++) { for ($i = 0; $i < 9; $i++) {
$sum += (10 - $i) * $isbn10{$i}; $sum += (10 - $i) * $isbn10[$i];
} }
// checksum // checksum
@ -183,9 +183,9 @@ class Zend_Validate_Isbn extends Zend_Validate_Abstract
$sum = 0; $sum = 0;
for ($i = 0; $i < 12; $i++) { for ($i = 0; $i < 12; $i++) {
if ($i % 2 == 0) { if ($i % 2 == 0) {
$sum += $isbn13{$i}; $sum += $isbn13[$i];
} else { } else {
$sum += 3 * $isbn13{$i}; $sum += 3 * $isbn13[$i];
} }
} }
// checksum // checksum