From 175001eccdae4fbc92aa95aae74d57cfece6196a Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 25 May 2021 11:47:26 +0000 Subject: php8: even more fix unmaintained id3 parser --- .../id3parser/src/getID3/getid3_lib.php | 84 +++++++++++----------- 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'vendor') diff --git a/vendor/lukasreschke/id3parser/src/getID3/getid3_lib.php b/vendor/lukasreschke/id3parser/src/getID3/getid3_lib.php index 377a84508..2cb3b2d09 100644 --- a/vendor/lukasreschke/id3parser/src/getID3/getid3_lib.php +++ b/vendor/lukasreschke/id3parser/src/getID3/getid3_lib.php @@ -183,7 +183,7 @@ class getid3_lib // 80-bit Apple SANE format // http://www.mactech.com/articles/mactech/Vol.06/06.01/SANENormalized/ $exponentstring = substr($bitword, 1, 15); - $isnormalized = intval($bitword{16}); + $isnormalized = intval($bitword[16]); $fractionstring = substr($bitword, 17, 63); $exponent = pow(2, self::Bin2Dec($exponentstring) - 16383); $fraction = $isnormalized + self::DecimalBinary2Float($fractionstring); @@ -243,10 +243,10 @@ class getid3_lib } for ($i = 0; $i < $bytewordlen; $i++) { if ($synchsafe) { // disregard MSB, effectively 7-bit bytes - //$intvalue = $intvalue | (ord($byteword{$i}) & 0x7F) << (($bytewordlen - 1 - $i) * 7); // faster, but runs into problems past 2^31 on 32-bit systems - $intvalue += (ord($byteword{$i}) & 0x7F) * pow(2, ($bytewordlen - 1 - $i) * 7); + //$intvalue = $intvalue | (ord($byteword[$i]) & 0x7F) << (($bytewordlen - 1 - $i) * 7); // faster, but runs into problems past 2^31 on 32-bit systems + $intvalue += (ord($byteword[$i]) & 0x7F) * pow(2, ($bytewordlen - 1 - $i) * 7); } else { - $intvalue += ord($byteword{$i}) * pow(256, ($bytewordlen - 1 - $i)); + $intvalue += ord($byteword[$i]) * pow(256, ($bytewordlen - 1 - $i)); } } if ($signed && !$synchsafe) { @@ -273,7 +273,7 @@ class getid3_lib $binvalue = ''; $bytewordlen = strlen($byteword); for ($i = 0; $i < $bytewordlen; $i++) { - $binvalue .= str_pad(decbin(ord($byteword{$i})), 8, '0', STR_PAD_LEFT); + $binvalue .= str_pad(decbin(ord($byteword[$i]})), 8, '0', STR_PAD_LEFT); } return $binvalue; } @@ -538,7 +538,7 @@ class getid3_lib $newcharstring .= "\xEF\xBB\xBF"; } for ($i = 0; $i < strlen($string); $i++) { - $charval = ord($string{$i}); + $charval = ord($string[$i]); $newcharstring .= self::iconv_fallback_int_utf8($charval); } return $newcharstring; @@ -551,7 +551,7 @@ class getid3_lib $newcharstring .= "\xFE\xFF"; } for ($i = 0; $i < strlen($string); $i++) { - $newcharstring .= "\x00".$string{$i}; + $newcharstring .= "\x00".$string[$i]; } return $newcharstring; } @@ -563,7 +563,7 @@ class getid3_lib $newcharstring .= "\xFF\xFE"; } for ($i = 0; $i < strlen($string); $i++) { - $newcharstring .= $string{$i}."\x00"; + $newcharstring .= $string[$i]."\x00"; } return $newcharstring; } @@ -583,27 +583,27 @@ class getid3_lib $offset = 0; $stringlength = strlen($string); while ($offset < $stringlength) { - if ((ord($string{$offset}) | 0x07) == 0xF7) { + if ((ord($string[$offset]) | 0x07) == 0xF7) { // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & - ((ord($string{($offset + 1)}) & 0x3F) << 12) & - ((ord($string{($offset + 2)}) & 0x3F) << 6) & - (ord($string{($offset + 3)}) & 0x3F); + $charval = ((ord($string[($offset + 0)]) & 0x07) << 18) & + ((ord($string[($offset + 1)]) & 0x3F) << 12) & + ((ord($string[($offset + 2)]) & 0x3F) << 6) & + (ord($string[($offset + 3)]) & 0x3F); $offset += 4; - } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { + } elseif ((ord($string[$offset]) | 0x0F) == 0xEF) { // 1110bbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & - ((ord($string{($offset + 1)}) & 0x3F) << 6) & - (ord($string{($offset + 2)}) & 0x3F); + $charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) & + ((ord($string[($offset + 1)]) & 0x3F) << 6) & + (ord($string[($offset + 2)]) & 0x3F); $offset += 3; - } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) { + } elseif ((ord($string[$offset]) | 0x1F) == 0xDF) { // 110bbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & - (ord($string{($offset + 1)}) & 0x3F); + $charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) & + (ord($string[($offset + 1)]) & 0x3F); $offset += 2; - } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { + } elseif ((ord($string[$offset]) | 0x7F) == 0x7F) { // 0bbbbbbb - $charval = ord($string{$offset}); + $charval = ord($string[$offset]); $offset += 1; } else { // error? throw some kind of warning here? @@ -626,27 +626,27 @@ class getid3_lib $offset = 0; $stringlength = strlen($string); while ($offset < $stringlength) { - if ((ord($string{$offset}) | 0x07) == 0xF7) { + if ((ord($string[$offset]) | 0x07) == 0xF7) { // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & - ((ord($string{($offset + 1)}) & 0x3F) << 12) & - ((ord($string{($offset + 2)}) & 0x3F) << 6) & - (ord($string{($offset + 3)}) & 0x3F); + $charval = ((ord($string[($offset + 0)]) & 0x07) << 18) & + ((ord($string[($offset + 1)]) & 0x3F) << 12) & + ((ord($string[($offset + 2)]) & 0x3F) << 6) & + (ord($string[($offset + 3)]) & 0x3F); $offset += 4; - } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { + } elseif ((ord($string[$offset]) | 0x0F) == 0xEF) { // 1110bbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & - ((ord($string{($offset + 1)}) & 0x3F) << 6) & - (ord($string{($offset + 2)}) & 0x3F); + $charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) & + ((ord($string[($offset + 1)]) & 0x3F) << 6) & + (ord($string[($offset + 2)]) & 0x3F); $offset += 3; - } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) { + } elseif ((ord($string[$offset]) | 0x1F) == 0xDF) { // 110bbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & - (ord($string{($offset + 1)}) & 0x3F); + $charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) & + (ord($string[($offset + 1)]) & 0x3F); $offset += 2; - } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { + } elseif ((ord($string[$offset]) | 0x7F) == 0x7F) { // 0bbbbbbb - $charval = ord($string{$offset}); + $charval = ord($string[$offset]); $offset += 1; } else { // error? throw some kind of warning here? @@ -669,27 +669,27 @@ class getid3_lib $offset = 0; $stringlength = strlen($string); while ($offset < $stringlength) { - if ((ord($string{$offset}) | 0x07) == 0xF7) { + if ((ord($string[$offset]) | 0x07) == 0xF7) { // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & ((ord($string{($offset + 1)}) & 0x3F) << 12) & ((ord($string{($offset + 2)}) & 0x3F) << 6) & (ord($string{($offset + 3)}) & 0x3F); $offset += 4; - } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { + } elseif ((ord($string[$offset]) | 0x0F) == 0xEF) { // 1110bbbb 10bbbbbb 10bbbbbb $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & ((ord($string{($offset + 1)}) & 0x3F) << 6) & (ord($string{($offset + 2)}) & 0x3F); $offset += 3; - } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) { + } elseif ((ord($string[$offset]) | 0x1F) == 0xDF) { // 110bbbbb 10bbbbbb $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & (ord($string{($offset + 1)}) & 0x3F); $offset += 2; - } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { + } elseif ((ord($string[$offset]) | 0x7F) == 0x7F) { // 0bbbbbbb - $charval = ord($string{$offset}); + $charval = ord($string[$offset]); $offset += 1; } else { // error? maybe throw some warning here? @@ -886,7 +886,7 @@ class getid3_lib case 'UTF-8': $strlen = strlen($string); for ($i = 0; $i < $strlen; $i++) { - $char_ord_val = ord($string{$i}); + $char_ord_val = ord($string[$i]); $charval = 0; if ($char_ord_val < 0x80) { $charval = $char_ord_val; -- cgit v1.2.3