Ticket #47751: 47751-External-getID3.patch
File 47751-External-getID3.patch, 28.0 KB (added by , 18 months ago) |
---|
-
src/wp-includes/ID3/getid3.lib.php
From dc21e51860cd00cee3c1a94309baacfb8496aaff Mon Sep 17 00:00:00 2001 From: jrfnl <jrfnl@users.noreply.github.com> Date: Mon, 22 Jul 2019 05:16:25 +0200 Subject: [PATCH] [External getID3] PHP 7.4 compatibility: fix deprecated curly brace array access PHP 7.4 will deprecated array access using curly braces. Ref: https://wiki.php.net/rfc/deprecate_curly_braces_array_access --- src/wp-includes/ID3/getid3.lib.php | 126 +++++++++--------- src/wp-includes/ID3/getid3.php | 4 +- .../ID3/module.audio-video.asf.php | 32 ++--- src/wp-includes/ID3/module.audio.ac3.php | 2 +- src/wp-includes/ID3/module.audio.mp3.php | 40 +++--- src/wp-includes/ID3/module.tag.id3v1.php | 2 +- src/wp-includes/ID3/module.tag.id3v2.php | 28 ++-- 7 files changed, 117 insertions(+), 117 deletions(-) diff --git a/src/wp-includes/ID3/getid3.lib.php b/src/wp-includes/ID3/getid3.lib.php index 1931bb3724..28bdd67fdc 100644
a b class getid3_lib 19 19 $returnstring = ''; 20 20 for ($i = 0; $i < strlen($string); $i++) { 21 21 if ($hex) { 22 $returnstring .= str_pad(dechex(ord($string {$i})), 2, '0', STR_PAD_LEFT);22 $returnstring .= str_pad(dechex(ord($string[$i])), 2, '0', STR_PAD_LEFT); 23 23 } else { 24 $returnstring .= ' '.(preg_match("#[\x20-\x7E]#", $string {$i}) ? $string{$i}: '¤');24 $returnstring .= ' '.(preg_match("#[\x20-\x7E]#", $string[$i]) ? $string[$i] : '¤'); 25 25 } 26 26 if ($spaces) { 27 27 $returnstring .= ' '; … … class getid3_lib 110 110 // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html 111 111 if (strpos($binarypointnumber, '.') === false) { 112 112 $binarypointnumber = '0.'.$binarypointnumber; 113 } elseif ($binarypointnumber {0}== '.') {113 } elseif ($binarypointnumber[0] == '.') { 114 114 $binarypointnumber = '0'.$binarypointnumber; 115 115 } 116 116 $exponent = 0; 117 while (($binarypointnumber {0}!= '1') || (substr($binarypointnumber, 1, 1) != '.')) {117 while (($binarypointnumber[0] != '1') || (substr($binarypointnumber, 1, 1) != '.')) { 118 118 if (substr($binarypointnumber, 1, 1) == '.') { 119 119 $exponent--; 120 120 $binarypointnumber = substr($binarypointnumber, 2, 1).'.'.substr($binarypointnumber, 3); … … class getid3_lib 122 122 $pointpos = strpos($binarypointnumber, '.'); 123 123 $exponent += ($pointpos - 1); 124 124 $binarypointnumber = str_replace('.', '', $binarypointnumber); 125 $binarypointnumber = $binarypointnumber {0}.'.'.substr($binarypointnumber, 1);125 $binarypointnumber = $binarypointnumber[0].'.'.substr($binarypointnumber, 1); 126 126 } 127 127 } 128 128 $binarypointnumber = str_pad(substr($binarypointnumber, 0, $maxbits + 2), $maxbits + 2, '0', STR_PAD_RIGHT); … … class getid3_lib 191 191 if (!$bitword) { 192 192 return 0; 193 193 } 194 $signbit = $bitword {0};194 $signbit = $bitword[0]; 195 195 196 196 switch (strlen($byteword) * 8) { 197 197 case 32: … … class getid3_lib 208 208 // 80-bit Apple SANE format 209 209 // http://www.mactech.com/articles/mactech/Vol.06/06.01/SANENormalized/ 210 210 $exponentstring = substr($bitword, 1, 15); 211 $isnormalized = intval($bitword {16});211 $isnormalized = intval($bitword[16]); 212 212 $fractionstring = substr($bitword, 17, 63); 213 213 $exponent = pow(2, self::Bin2Dec($exponentstring) - 16383); 214 214 $fraction = $isnormalized + self::DecimalBinary2Float($fractionstring); … … class getid3_lib 269 269 for ($i = 0; $i < $bytewordlen; $i++) { 270 270 if ($synchsafe) { // disregard MSB, effectively 7-bit bytes 271 271 //$intvalue = $intvalue | (ord($byteword{$i}) & 0x7F) << (($bytewordlen - 1 - $i) * 7); // faster, but runs into problems past 2^31 on 32-bit systems 272 $intvalue += (ord($byteword {$i}) & 0x7F) * pow(2, ($bytewordlen - 1 - $i) * 7);272 $intvalue += (ord($byteword[$i]) & 0x7F) * pow(2, ($bytewordlen - 1 - $i) * 7); 273 273 } else { 274 $intvalue += ord($byteword {$i}) * pow(256, ($bytewordlen - 1 - $i));274 $intvalue += ord($byteword[$i]) * pow(256, ($bytewordlen - 1 - $i)); 275 275 } 276 276 } 277 277 if ($signed && !$synchsafe) { … … class getid3_lib 301 301 $binvalue = ''; 302 302 $bytewordlen = strlen($byteword); 303 303 for ($i = 0; $i < $bytewordlen; $i++) { 304 $binvalue .= str_pad(decbin(ord($byteword {$i})), 8, '0', STR_PAD_LEFT);304 $binvalue .= str_pad(decbin(ord($byteword[$i])), 8, '0', STR_PAD_LEFT); 305 305 } 306 306 return $binvalue; 307 307 } … … class getid3_lib 345 345 public static function Bin2Dec($binstring, $signed=false) { 346 346 $signmult = 1; 347 347 if ($signed) { 348 if ($binstring {0}== '1') {348 if ($binstring[0] == '1') { 349 349 $signmult = -1; 350 350 } 351 351 $binstring = substr($binstring, 1); … … class getid3_lib 709 709 $newcharstring .= "\xEF\xBB\xBF"; 710 710 } 711 711 for ($i = 0; $i < strlen($string); $i++) { 712 $charval = ord($string {$i});712 $charval = ord($string[$i]); 713 713 $newcharstring .= self::iconv_fallback_int_utf8($charval); 714 714 } 715 715 return $newcharstring; … … class getid3_lib 722 722 $newcharstring .= "\xFE\xFF"; 723 723 } 724 724 for ($i = 0; $i < strlen($string); $i++) { 725 $newcharstring .= "\x00".$string {$i};725 $newcharstring .= "\x00".$string[$i]; 726 726 } 727 727 return $newcharstring; 728 728 } … … class getid3_lib 734 734 $newcharstring .= "\xFF\xFE"; 735 735 } 736 736 for ($i = 0; $i < strlen($string); $i++) { 737 $newcharstring .= $string {$i}."\x00";737 $newcharstring .= $string[$i]."\x00"; 738 738 } 739 739 return $newcharstring; 740 740 } … … class getid3_lib 754 754 $offset = 0; 755 755 $stringlength = strlen($string); 756 756 while ($offset < $stringlength) { 757 if ((ord($string {$offset}) | 0x07) == 0xF7) {757 if ((ord($string[$offset]) | 0x07) == 0xF7) { 758 758 // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb 759 $charval = ((ord($string {($offset + 0)}) & 0x07) << 18) &760 ((ord($string {($offset + 1)}) & 0x3F) << 12) &761 ((ord($string {($offset + 2)}) & 0x3F) << 6) &762 (ord($string {($offset + 3)}) & 0x3F);759 $charval = ((ord($string[($offset + 0)]) & 0x07) << 18) & 760 ((ord($string[($offset + 1)]) & 0x3F) << 12) & 761 ((ord($string[($offset + 2)]) & 0x3F) << 6) & 762 (ord($string[($offset + 3)]) & 0x3F); 763 763 $offset += 4; 764 } elseif ((ord($string {$offset}) | 0x0F) == 0xEF) {764 } elseif ((ord($string[$offset]) | 0x0F) == 0xEF) { 765 765 // 1110bbbb 10bbbbbb 10bbbbbb 766 $charval = ((ord($string {($offset + 0)}) & 0x0F) << 12) &767 ((ord($string {($offset + 1)}) & 0x3F) << 6) &768 (ord($string {($offset + 2)}) & 0x3F);766 $charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) & 767 ((ord($string[($offset + 1)]) & 0x3F) << 6) & 768 (ord($string[($offset + 2)]) & 0x3F); 769 769 $offset += 3; 770 } elseif ((ord($string {$offset}) | 0x1F) == 0xDF) {770 } elseif ((ord($string[$offset]) | 0x1F) == 0xDF) { 771 771 // 110bbbbb 10bbbbbb 772 $charval = ((ord($string {($offset + 0)}) & 0x1F) << 6) &773 (ord($string {($offset + 1)}) & 0x3F);772 $charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) & 773 (ord($string[($offset + 1)]) & 0x3F); 774 774 $offset += 2; 775 } elseif ((ord($string {$offset}) | 0x7F) == 0x7F) {775 } elseif ((ord($string[$offset]) | 0x7F) == 0x7F) { 776 776 // 0bbbbbbb 777 $charval = ord($string {$offset});777 $charval = ord($string[$offset]); 778 778 $offset += 1; 779 779 } else { 780 780 // error? throw some kind of warning here? … … class getid3_lib 797 797 $offset = 0; 798 798 $stringlength = strlen($string); 799 799 while ($offset < $stringlength) { 800 if ((ord($string {$offset}) | 0x07) == 0xF7) {800 if ((ord($string[$offset]) | 0x07) == 0xF7) { 801 801 // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb 802 $charval = ((ord($string {($offset + 0)}) & 0x07) << 18) &803 ((ord($string {($offset + 1)}) & 0x3F) << 12) &804 ((ord($string {($offset + 2)}) & 0x3F) << 6) &805 (ord($string {($offset + 3)}) & 0x3F);802 $charval = ((ord($string[($offset + 0)]) & 0x07) << 18) & 803 ((ord($string[($offset + 1)]) & 0x3F) << 12) & 804 ((ord($string[($offset + 2)]) & 0x3F) << 6) & 805 (ord($string[($offset + 3)]) & 0x3F); 806 806 $offset += 4; 807 } elseif ((ord($string {$offset}) | 0x0F) == 0xEF) {807 } elseif ((ord($string[$offset]) | 0x0F) == 0xEF) { 808 808 // 1110bbbb 10bbbbbb 10bbbbbb 809 $charval = ((ord($string {($offset + 0)}) & 0x0F) << 12) &810 ((ord($string {($offset + 1)}) & 0x3F) << 6) &811 (ord($string {($offset + 2)}) & 0x3F);809 $charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) & 810 ((ord($string[($offset + 1)]) & 0x3F) << 6) & 811 (ord($string[($offset + 2)]) & 0x3F); 812 812 $offset += 3; 813 } elseif ((ord($string {$offset}) | 0x1F) == 0xDF) {813 } elseif ((ord($string[$offset]) | 0x1F) == 0xDF) { 814 814 // 110bbbbb 10bbbbbb 815 $charval = ((ord($string {($offset + 0)}) & 0x1F) << 6) &816 (ord($string {($offset + 1)}) & 0x3F);815 $charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) & 816 (ord($string[($offset + 1)]) & 0x3F); 817 817 $offset += 2; 818 } elseif ((ord($string {$offset}) | 0x7F) == 0x7F) {818 } elseif ((ord($string[$offset]) | 0x7F) == 0x7F) { 819 819 // 0bbbbbbb 820 $charval = ord($string {$offset});820 $charval = ord($string[$offset]); 821 821 $offset += 1; 822 822 } else { 823 823 // error? throw some kind of warning here? … … class getid3_lib 840 840 $offset = 0; 841 841 $stringlength = strlen($string); 842 842 while ($offset < $stringlength) { 843 if ((ord($string {$offset}) | 0x07) == 0xF7) {843 if ((ord($string[$offset]) | 0x07) == 0xF7) { 844 844 // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb 845 $charval = ((ord($string {($offset + 0)}) & 0x07) << 18) &846 ((ord($string {($offset + 1)}) & 0x3F) << 12) &847 ((ord($string {($offset + 2)}) & 0x3F) << 6) &848 (ord($string {($offset + 3)}) & 0x3F);845 $charval = ((ord($string[($offset + 0)]) & 0x07) << 18) & 846 ((ord($string[($offset + 1)]) & 0x3F) << 12) & 847 ((ord($string[($offset + 2)]) & 0x3F) << 6) & 848 (ord($string[($offset + 3)]) & 0x3F); 849 849 $offset += 4; 850 } elseif ((ord($string {$offset}) | 0x0F) == 0xEF) {850 } elseif ((ord($string[$offset]) | 0x0F) == 0xEF) { 851 851 // 1110bbbb 10bbbbbb 10bbbbbb 852 $charval = ((ord($string {($offset + 0)}) & 0x0F) << 12) &853 ((ord($string {($offset + 1)}) & 0x3F) << 6) &854 (ord($string {($offset + 2)}) & 0x3F);852 $charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) & 853 ((ord($string[($offset + 1)]) & 0x3F) << 6) & 854 (ord($string[($offset + 2)]) & 0x3F); 855 855 $offset += 3; 856 } elseif ((ord($string {$offset}) | 0x1F) == 0xDF) {856 } elseif ((ord($string[$offset]) | 0x1F) == 0xDF) { 857 857 // 110bbbbb 10bbbbbb 858 $charval = ((ord($string {($offset + 0)}) & 0x1F) << 6) &859 (ord($string {($offset + 1)}) & 0x3F);858 $charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) & 859 (ord($string[($offset + 1)]) & 0x3F); 860 860 $offset += 2; 861 } elseif ((ord($string {$offset}) | 0x7F) == 0x7F) {861 } elseif ((ord($string[$offset]) | 0x7F) == 0x7F) { 862 862 // 0bbbbbbb 863 $charval = ord($string {$offset});863 $charval = ord($string[$offset]); 864 864 $offset += 1; 865 865 } else { 866 866 // error? maybe throw some warning here? … … class getid3_lib 1069 1069 case 'utf-8': 1070 1070 $strlen = strlen($string); 1071 1071 for ($i = 0; $i < $strlen; $i++) { 1072 $char_ord_val = ord($string {$i});1072 $char_ord_val = ord($string[$i]); 1073 1073 $charval = 0; 1074 1074 if ($char_ord_val < 0x80) { 1075 1075 $charval = $char_ord_val; 1076 1076 } elseif ((($char_ord_val & 0xF0) >> 4) == 0x0F && $i+3 < $strlen) { 1077 1077 $charval = (($char_ord_val & 0x07) << 18); 1078 $charval += ((ord($string {++$i}) & 0x3F) << 12);1079 $charval += ((ord($string {++$i}) & 0x3F) << 6);1080 $charval += (ord($string {++$i}) & 0x3F);1078 $charval += ((ord($string[++$i]) & 0x3F) << 12); 1079 $charval += ((ord($string[++$i]) & 0x3F) << 6); 1080 $charval += (ord($string[++$i]) & 0x3F); 1081 1081 } elseif ((($char_ord_val & 0xE0) >> 5) == 0x07 && $i+2 < $strlen) { 1082 1082 $charval = (($char_ord_val & 0x0F) << 12); 1083 $charval += ((ord($string {++$i}) & 0x3F) << 6);1084 $charval += (ord($string {++$i}) & 0x3F);1083 $charval += ((ord($string[++$i]) & 0x3F) << 6); 1084 $charval += (ord($string[++$i]) & 0x3F); 1085 1085 } elseif ((($char_ord_val & 0xC0) >> 6) == 0x03 && $i+1 < $strlen) { 1086 1086 $charval = (($char_ord_val & 0x1F) << 6); 1087 $charval += (ord($string {++$i}) & 0x3F);1087 $charval += (ord($string[++$i]) & 0x3F); 1088 1088 } 1089 1089 if (($charval >= 32) && ($charval <= 127)) { 1090 1090 $HTMLstring .= htmlentities(chr($charval)); -
src/wp-includes/ID3/getid3.php
diff --git a/src/wp-includes/ID3/getid3.php b/src/wp-includes/ID3/getid3.php index 7732c19587..f39175ad34 100644
a b class getID3 383 383 $header = fread($this->fp, 10); 384 384 if ((substr($header, 0, 3) == 'ID3') && (strlen($header) == 10)) { 385 385 $this->info['id3v2']['header'] = true; 386 $this->info['id3v2']['majorversion'] = ord($header {3});387 $this->info['id3v2']['minorversion'] = ord($header {4});386 $this->info['id3v2']['majorversion'] = ord($header[3]); 387 $this->info['id3v2']['minorversion'] = ord($header[4]); 388 388 $this->info['avdataoffset'] += getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length 389 389 } 390 390 } -
src/wp-includes/ID3/module.audio-video.asf.php
diff --git a/src/wp-includes/ID3/module.audio-video.asf.php b/src/wp-includes/ID3/module.audio-video.asf.php index 23d3a0e680..7463170e63 100644
a b class getid3_asf extends getid3_handler { 1618 1618 } 1619 1619 1620 1620 public static function BytestringToGUID($Bytestring) { 1621 $GUIDstring = str_pad(dechex(ord($Bytestring {3})), 2, '0', STR_PAD_LEFT);1622 $GUIDstring .= str_pad(dechex(ord($Bytestring {2})), 2, '0', STR_PAD_LEFT);1623 $GUIDstring .= str_pad(dechex(ord($Bytestring {1})), 2, '0', STR_PAD_LEFT);1624 $GUIDstring .= str_pad(dechex(ord($Bytestring {0})), 2, '0', STR_PAD_LEFT);1621 $GUIDstring = str_pad(dechex(ord($Bytestring[3])), 2, '0', STR_PAD_LEFT); 1622 $GUIDstring .= str_pad(dechex(ord($Bytestring[2])), 2, '0', STR_PAD_LEFT); 1623 $GUIDstring .= str_pad(dechex(ord($Bytestring[1])), 2, '0', STR_PAD_LEFT); 1624 $GUIDstring .= str_pad(dechex(ord($Bytestring[0])), 2, '0', STR_PAD_LEFT); 1625 1625 $GUIDstring .= '-'; 1626 $GUIDstring .= str_pad(dechex(ord($Bytestring {5})), 2, '0', STR_PAD_LEFT);1627 $GUIDstring .= str_pad(dechex(ord($Bytestring {4})), 2, '0', STR_PAD_LEFT);1626 $GUIDstring .= str_pad(dechex(ord($Bytestring[5])), 2, '0', STR_PAD_LEFT); 1627 $GUIDstring .= str_pad(dechex(ord($Bytestring[4])), 2, '0', STR_PAD_LEFT); 1628 1628 $GUIDstring .= '-'; 1629 $GUIDstring .= str_pad(dechex(ord($Bytestring {7})), 2, '0', STR_PAD_LEFT);1630 $GUIDstring .= str_pad(dechex(ord($Bytestring {6})), 2, '0', STR_PAD_LEFT);1629 $GUIDstring .= str_pad(dechex(ord($Bytestring[7])), 2, '0', STR_PAD_LEFT); 1630 $GUIDstring .= str_pad(dechex(ord($Bytestring[6])), 2, '0', STR_PAD_LEFT); 1631 1631 $GUIDstring .= '-'; 1632 $GUIDstring .= str_pad(dechex(ord($Bytestring {8})), 2, '0', STR_PAD_LEFT);1633 $GUIDstring .= str_pad(dechex(ord($Bytestring {9})), 2, '0', STR_PAD_LEFT);1632 $GUIDstring .= str_pad(dechex(ord($Bytestring[8])), 2, '0', STR_PAD_LEFT); 1633 $GUIDstring .= str_pad(dechex(ord($Bytestring[9])), 2, '0', STR_PAD_LEFT); 1634 1634 $GUIDstring .= '-'; 1635 $GUIDstring .= str_pad(dechex(ord($Bytestring {10})), 2, '0', STR_PAD_LEFT);1636 $GUIDstring .= str_pad(dechex(ord($Bytestring {11})), 2, '0', STR_PAD_LEFT);1637 $GUIDstring .= str_pad(dechex(ord($Bytestring {12})), 2, '0', STR_PAD_LEFT);1638 $GUIDstring .= str_pad(dechex(ord($Bytestring {13})), 2, '0', STR_PAD_LEFT);1639 $GUIDstring .= str_pad(dechex(ord($Bytestring {14})), 2, '0', STR_PAD_LEFT);1640 $GUIDstring .= str_pad(dechex(ord($Bytestring {15})), 2, '0', STR_PAD_LEFT);1635 $GUIDstring .= str_pad(dechex(ord($Bytestring[10])), 2, '0', STR_PAD_LEFT); 1636 $GUIDstring .= str_pad(dechex(ord($Bytestring[11])), 2, '0', STR_PAD_LEFT); 1637 $GUIDstring .= str_pad(dechex(ord($Bytestring[12])), 2, '0', STR_PAD_LEFT); 1638 $GUIDstring .= str_pad(dechex(ord($Bytestring[13])), 2, '0', STR_PAD_LEFT); 1639 $GUIDstring .= str_pad(dechex(ord($Bytestring[14])), 2, '0', STR_PAD_LEFT); 1640 $GUIDstring .= str_pad(dechex(ord($Bytestring[15])), 2, '0', STR_PAD_LEFT); 1641 1641 1642 1642 return strtoupper($GUIDstring); 1643 1643 } -
src/wp-includes/ID3/module.audio.ac3.php
diff --git a/src/wp-includes/ID3/module.audio.ac3.php b/src/wp-includes/ID3/module.audio.ac3.php index 27c328d3d3..59bf72a558 100644
a b $thisfile_ac3['bitrate'] = round(($thisfile_ac3['bitrate'] * 1.05) / 16000) * 16 623 623 // -8 -42.14 dB 624 624 625 625 $fourbit = str_pad(decbin(($compre & 0xF0) >> 4), 4, '0', STR_PAD_LEFT); 626 if ($fourbit {0}== '1') {626 if ($fourbit[0] == '1') { 627 627 $log_gain = -8 + bindec(substr($fourbit, 1)); 628 628 } else { 629 629 $log_gain = bindec(substr($fourbit, 1)); -
src/wp-includes/ID3/module.audio.mp3.php
diff --git a/src/wp-includes/ID3/module.audio.mp3.php b/src/wp-includes/ID3/module.audio.mp3.php index ed2d84434c..66178ad10b 100644
a b class getid3_mp3 extends getid3_handler 678 678 if ($thisfile_mpeg_audio['xing_flags']['toc']) { 679 679 $LAMEtocData = substr($headerstring, $VBRidOffset + 16, 100); 680 680 for ($i = 0; $i < 100; $i++) { 681 $thisfile_mpeg_audio['toc'][$i] = ord($LAMEtocData {$i});681 $thisfile_mpeg_audio['toc'][$i] = ord($LAMEtocData[$i]); 682 682 } 683 683 } 684 684 if ($thisfile_mpeg_audio['xing_flags']['vbr_scale']) { … … class getid3_mp3 extends getid3_handler 1137 1137 1138 1138 $SyncPattern1 = substr($MPEGaudioData, 0, 4); 1139 1139 // may be different pattern due to padding 1140 $SyncPattern2 = $SyncPattern1 {0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) | 0x02).$SyncPattern1{3};1140 $SyncPattern2 = $SyncPattern1[0].$SyncPattern1[1].chr(ord($SyncPattern1[2]) | 0x02).$SyncPattern1[3]; 1141 1141 if ($SyncPattern2 === $SyncPattern1) { 1142 $SyncPattern2 = $SyncPattern1 {0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) & 0xFD).$SyncPattern1{3};1142 $SyncPattern2 = $SyncPattern1[0].$SyncPattern1[1].chr(ord($SyncPattern1[2]) & 0xFD).$SyncPattern1[3]; 1143 1143 } 1144 1144 1145 1145 $framelength = false; … … class getid3_mp3 extends getid3_handler 1241 1241 if (strlen($head4) < 4) { 1242 1242 break; 1243 1243 } 1244 if ($head4 {0}!= "\xFF") {1244 if ($head4[0] != "\xFF") { 1245 1245 for ($i = 1; $i < 4; $i++) { 1246 if ($head4 {$i}== "\xFF") {1246 if ($head4[$i] == "\xFF") { 1247 1247 $this->fseek($i - 4, SEEK_CUR); 1248 1248 continue 2; 1249 1249 } … … class getid3_mp3 extends getid3_handler 1275 1275 $WhereWeWere = $this->ftell(); 1276 1276 $this->fseek($MPEGaudioHeaderLengthCache[$head4] - 4, SEEK_CUR); 1277 1277 $next4 = $this->fread(4); 1278 if ($next4 {0}== "\xFF") {1278 if ($next4[0] == "\xFF") { 1279 1279 if (!isset($MPEGaudioHeaderDecodeCache[$next4])) { 1280 1280 $MPEGaudioHeaderDecodeCache[$next4] = self::MPEGaudioHeaderDecode($next4); 1281 1281 } … … class getid3_mp3 extends getid3_handler 1416 1416 return false; 1417 1417 } 1418 1418 1419 if (($header {$SynchSeekOffset} == "\xFF") && ($header{($SynchSeekOffset + 1)}> "\xE0")) { // synch detected1419 if (($header[$SynchSeekOffset] == "\xFF") && ($header[($SynchSeekOffset + 1)] > "\xE0")) { // synch detected 1420 1420 if (!isset($FirstFrameThisfileInfo) && !isset($info['mpeg']['audio'])) { 1421 1421 $FirstFrameThisfileInfo = $info; 1422 1422 $FirstFrameAVDataOffset = $avdataoffset + $SynchSeekOffset; … … class getid3_mp3 extends getid3_handler 1510 1510 $this->fseek($scan_start_offset[$current_segment]); 1511 1511 $buffer_4k = $this->fread(4096); 1512 1512 for ($j = 0; $j < (strlen($buffer_4k) - 4); $j++) { 1513 if (($buffer_4k {$j} == "\xFF") && ($buffer_4k{($j + 1)}> "\xE0")) { // synch detected1513 if (($buffer_4k[$j] == "\xFF") && ($buffer_4k[($j + 1)] > "\xE0")) { // synch detected 1514 1514 if ($this->decodeMPEGaudioHeader($scan_start_offset[$current_segment] + $j, $dummy, false, false, $FastMode)) { 1515 1515 $calculated_next_offset = $scan_start_offset[$current_segment] + $j + $dummy['mpeg']['audio']['framelength']; 1516 1516 if ($this->decodeMPEGaudioHeader($calculated_next_offset, $dummy, false, false, $FastMode)) { … … class getid3_mp3 extends getid3_handler 1794 1794 } 1795 1795 1796 1796 $MPEGrawHeader['synch'] = (getid3_lib::BigEndian2Int(substr($Header4Bytes, 0, 2)) & 0xFFE0) >> 4; 1797 $MPEGrawHeader['version'] = (ord($Header4Bytes {1}) & 0x18) >> 3; // BB1798 $MPEGrawHeader['layer'] = (ord($Header4Bytes {1}) & 0x06) >> 1; // CC1799 $MPEGrawHeader['protection'] = (ord($Header4Bytes {1}) & 0x01); // D1800 $MPEGrawHeader['bitrate'] = (ord($Header4Bytes {2}) & 0xF0) >> 4; // EEEE1801 $MPEGrawHeader['sample_rate'] = (ord($Header4Bytes {2}) & 0x0C) >> 2; // FF1802 $MPEGrawHeader['padding'] = (ord($Header4Bytes {2}) & 0x02) >> 1; // G1803 $MPEGrawHeader['private'] = (ord($Header4Bytes {2}) & 0x01); // H1804 $MPEGrawHeader['channelmode'] = (ord($Header4Bytes {3}) & 0xC0) >> 6; // II1805 $MPEGrawHeader['modeextension'] = (ord($Header4Bytes {3}) & 0x30) >> 4; // JJ1806 $MPEGrawHeader['copyright'] = (ord($Header4Bytes {3}) & 0x08) >> 3; // K1807 $MPEGrawHeader['original'] = (ord($Header4Bytes {3}) & 0x04) >> 2; // L1808 $MPEGrawHeader['emphasis'] = (ord($Header4Bytes {3}) & 0x03); // MM1797 $MPEGrawHeader['version'] = (ord($Header4Bytes[1]) & 0x18) >> 3; // BB 1798 $MPEGrawHeader['layer'] = (ord($Header4Bytes[1]) & 0x06) >> 1; // CC 1799 $MPEGrawHeader['protection'] = (ord($Header4Bytes[1]) & 0x01); // D 1800 $MPEGrawHeader['bitrate'] = (ord($Header4Bytes[2]) & 0xF0) >> 4; // EEEE 1801 $MPEGrawHeader['sample_rate'] = (ord($Header4Bytes[2]) & 0x0C) >> 2; // FF 1802 $MPEGrawHeader['padding'] = (ord($Header4Bytes[2]) & 0x02) >> 1; // G 1803 $MPEGrawHeader['private'] = (ord($Header4Bytes[2]) & 0x01); // H 1804 $MPEGrawHeader['channelmode'] = (ord($Header4Bytes[3]) & 0xC0) >> 6; // II 1805 $MPEGrawHeader['modeextension'] = (ord($Header4Bytes[3]) & 0x30) >> 4; // JJ 1806 $MPEGrawHeader['copyright'] = (ord($Header4Bytes[3]) & 0x08) >> 3; // K 1807 $MPEGrawHeader['original'] = (ord($Header4Bytes[3]) & 0x04) >> 2; // L 1808 $MPEGrawHeader['emphasis'] = (ord($Header4Bytes[3]) & 0x03); // MM 1809 1809 1810 1810 return $MPEGrawHeader; 1811 1811 } -
src/wp-includes/ID3/module.tag.id3v1.php
diff --git a/src/wp-includes/ID3/module.tag.id3v1.php b/src/wp-includes/ID3/module.tag.id3v1.php index d160e9b44a..7d033eb010 100644
a b class getid3_id3v1 extends getid3_handler 43 43 44 44 // If second-last byte of comment field is null and last byte of comment field is non-null 45 45 // then this is ID3v1.1 and the comment field is 28 bytes long and the 30th byte is the track number 46 if (($id3v1tag {125} === "\x00") && ($id3v1tag{126}!== "\x00")) {46 if (($id3v1tag[125] === "\x00") && ($id3v1tag[126] !== "\x00")) { 47 47 $ParsedID3v1['track'] = ord(substr($ParsedID3v1['comment'], 29, 1)); 48 48 $ParsedID3v1['comment'] = substr($ParsedID3v1['comment'], 0, 28); 49 49 } -
src/wp-includes/ID3/module.tag.id3v2.php
diff --git a/src/wp-includes/ID3/module.tag.id3v2.php b/src/wp-includes/ID3/module.tag.id3v2.php index fc586e8e13..8829c6e65f 100644
a b class getid3_id3v2 extends getid3_handler 56 56 $header = $this->fread(10); 57 57 if (substr($header, 0, 3) == 'ID3' && strlen($header) == 10) { 58 58 59 $thisfile_id3v2['majorversion'] = ord($header {3});60 $thisfile_id3v2['minorversion'] = ord($header {4});59 $thisfile_id3v2['majorversion'] = ord($header[3]); 60 $thisfile_id3v2['minorversion'] = ord($header[4]); 61 61 62 62 // shortcut 63 63 $id3v2_majorversion = &$thisfile_id3v2['majorversion']; … … class getid3_id3v2 extends getid3_handler 76 76 77 77 } 78 78 79 $id3_flags = ord($header {5});79 $id3_flags = ord($header[5]); 80 80 switch ($id3v2_majorversion) { 81 81 case 2: 82 82 // %ab000000 in v2.2 … … class getid3_id3v2 extends getid3_handler 257 257 $thisfile_id3v2['padding']['length'] = strlen($framedata); 258 258 $thisfile_id3v2['padding']['valid'] = true; 259 259 for ($i = 0; $i < $thisfile_id3v2['padding']['length']; $i++) { 260 if ($framedata {$i}!= "\x00") {260 if ($framedata[$i] != "\x00") { 261 261 $thisfile_id3v2['padding']['valid'] = false; 262 262 $thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i; 263 263 $this->warning('Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)'); … … class getid3_id3v2 extends getid3_handler 319 319 320 320 $len = strlen($framedata); 321 321 for ($i = 0; $i < $len; $i++) { 322 if ($framedata {$i}!= "\x00") {322 if ($framedata[$i] != "\x00") { 323 323 $thisfile_id3v2['padding']['valid'] = false; 324 324 $thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i; 325 325 $this->warning('Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)'); … … class getid3_id3v2 extends getid3_handler 427 427 $footer = $this->fread(10); 428 428 if (substr($footer, 0, 3) == '3DI') { 429 429 $thisfile_id3v2['footer'] = true; 430 $thisfile_id3v2['majorversion_footer'] = ord($footer {3});431 $thisfile_id3v2['minorversion_footer'] = ord($footer {4});430 $thisfile_id3v2['majorversion_footer'] = ord($footer[3]); 431 $thisfile_id3v2['minorversion_footer'] = ord($footer[4]); 432 432 } 433 433 if ($thisfile_id3v2['majorversion_footer'] <= 4) { 434 $id3_flags = ord(substr($footer {5}));434 $id3_flags = ord(substr($footer[5])); 435 435 $thisfile_id3v2_flags['unsynch_footer'] = (bool) ($id3_flags & 0x80); 436 436 $thisfile_id3v2_flags['extfoot_footer'] = (bool) ($id3_flags & 0x40); 437 437 $thisfile_id3v2_flags['experim_footer'] = (bool) ($id3_flags & 0x20); … … class getid3_id3v2 extends getid3_handler 678 678 //unset($parsedFrame['data']); do not unset, may be needed elsewhere, e.g. for replaygain 679 679 680 680 681 } elseif ($parsedFrame['frame_name'] {0}== 'T') { // 4.2. T??[?] Text information frame681 } elseif ($parsedFrame['frame_name'][0] == 'T') { // 4.2. T??[?] Text information frame 682 682 // There may only be one text information frame of its kind in an tag. 683 683 // <Header for 'Text information frame', ID: 'T000' - 'TZZZ', 684 684 // excluding 'TXXX' described in 4.2.6.> … … class getid3_id3v2 extends getid3_handler 782 782 unset($parsedFrame['data']); 783 783 784 784 785 } elseif ($parsedFrame['frame_name'] {0}== 'W') { // 4.3. W??? URL link frames785 } elseif ($parsedFrame['frame_name'][0] == 'W') { // 4.3. W??? URL link frames 786 786 // There may only be one URL link frame of its kind in a tag, 787 787 // except when stated otherwise in the frame description 788 788 // <Header for 'URL link frame', ID: 'W000' - 'WZZZ', excluding 'WXXX' … … class getid3_id3v2 extends getid3_handler 1061 1061 $parsedFrame['lyrics'][$timestampindex]['data'] = substr($frame_remainingdata, $frame_offset, $frame_terminatorpos - $frame_offset); 1062 1062 1063 1063 $frame_remainingdata = substr($frame_remainingdata, $frame_terminatorpos + strlen($frame_textencoding_terminator)); 1064 if (($timestampindex == 0) && (ord($frame_remainingdata {0}) != 0)) {1064 if (($timestampindex == 0) && (ord($frame_remainingdata[0]) != 0)) { 1065 1065 // timestamp probably omitted for first data item 1066 1066 } else { 1067 1067 $parsedFrame['lyrics'][$timestampindex]['timestamp'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 4)); … … class getid3_id3v2 extends getid3_handler 3608 3608 3609 3609 public static function IsANumber($numberstring, $allowdecimal=false, $allownegative=false) { 3610 3610 for ($i = 0; $i < strlen($numberstring); $i++) { 3611 if ((chr($numberstring {$i}) < chr('0')) || (chr($numberstring{$i}) > chr('9'))) {3612 if (($numberstring {$i}== '.') && $allowdecimal) {3611 if ((chr($numberstring[$i]) < chr('0')) || (chr($numberstring[$i]) > chr('9'))) { 3612 if (($numberstring[$i] == '.') && $allowdecimal) { 3613 3613 // allowed 3614 } elseif (($numberstring {$i}== '-') && $allownegative && ($i == 0)) {3614 } elseif (($numberstring[$i] == '-') && $allownegative && ($i == 0)) { 3615 3615 // allowed 3616 3616 } else { 3617 3617 return false;