Skip to content

Commit 8cf765e

Browse files
Merge pull request #195 from jrfnl/feature/2.0/php-7.4-fix-deprecated-curly-brace-array-access
[2.0] PHP 7.4 compatibility: fix deprecated curly brace array access
2 parents 0e1fa0e + 943f6cb commit 8cf765e

23 files changed

+242
-242
lines changed

demos/demo.browse.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
$deletefilemessage = 'FAILED to delete '.$_REQUEST['deletefile'].' - file does not exist';
6666
}
6767
if (isset($_REQUEST['noalert'])) {
68-
echo '<span style="font-weight: bold; color: #'.(($deletefilemessage{0} == 'F') ? 'FF0000' : '008000').';">'.htmlentities($deletefilemessage, ENT_QUOTES).'</span><hr>';
68+
echo '<span style="font-weight: bold; color: #'.(($deletefilemessage[0] == 'F') ? 'FF0000' : '008000').';">'.htmlentities($deletefilemessage, ENT_QUOTES).'</span><hr>';
6969
} else {
7070
echo '<script type="text/javascript">alert("'.addslashes($deletefilemessage).'");</script>';
7171
}

demos/demo.mp3header.php

+56-56
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ function table_var_dump($variable) {
8888
$variable = str_replace(chr(0), ' ', $variable);
8989
$varlen = strlen($variable);
9090
for ($i = 0; $i < $varlen; $i++) {
91-
if (preg_match('#['.chr(0x0A).chr(0x0D).' -;0-9A-Za-z]#', $variable{$i})) {
92-
$returnstring .= $variable{$i};
91+
if (preg_match('#['.chr(0x0A).chr(0x0D).' -;0-9A-Za-z]#', $variable[$i])) {
92+
$returnstring .= $variable[$i];
9393
} else {
94-
$returnstring .= '&#'.str_pad(ord($variable{$i}), 3, '0', STR_PAD_LEFT).';';
94+
$returnstring .= '&#'.str_pad(ord($variable[$i]), 3, '0', STR_PAD_LEFT).';';
9595
}
9696
}
9797
$returnstring = nl2br($returnstring);
@@ -242,19 +242,19 @@ function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) {
242242
// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html
243243
if (strpos($binarypointnumber, '.') === false) {
244244
$binarypointnumber = '0.'.$binarypointnumber;
245-
} elseif ($binarypointnumber{0} == '.') {
245+
} elseif ($binarypointnumber[0] == '.') {
246246
$binarypointnumber = '0'.$binarypointnumber;
247247
}
248248
$exponent = 0;
249-
while (($binarypointnumber{0} != '1') || (substr($binarypointnumber, 1, 1) != '.')) {
249+
while (($binarypointnumber[0] != '1') || (substr($binarypointnumber, 1, 1) != '.')) {
250250
if (substr($binarypointnumber, 1, 1) == '.') {
251251
$exponent--;
252252
$binarypointnumber = substr($binarypointnumber, 2, 1).'.'.substr($binarypointnumber, 3);
253253
} else {
254254
$pointpos = strpos($binarypointnumber, '.');
255255
$exponent += ($pointpos - 1);
256256
$binarypointnumber = str_replace('.', '', $binarypointnumber);
257-
$binarypointnumber = $binarypointnumber{0}.'.'.substr($binarypointnumber, 1);
257+
$binarypointnumber = $binarypointnumber[0].'.'.substr($binarypointnumber, 1);
258258
}
259259
}
260260
$binarypointnumber = str_pad(substr($binarypointnumber, 0, $maxbits + 2), $maxbits + 2, '0', STR_PAD_RIGHT);
@@ -324,7 +324,7 @@ function BigEndian2Float($byteword) {
324324
// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee.html
325325

326326
$bitword = BigEndian2Bin($byteword);
327-
$signbit = $bitword{0};
327+
$signbit = $bitword[0];
328328

329329
switch (strlen($byteword) * 8) {
330330
case 32:
@@ -397,9 +397,9 @@ function BigEndian2Int($byteword, $synchsafe=false, $signed=false) {
397397
$bytewordlen = strlen($byteword);
398398
for ($i = 0; $i < $bytewordlen; $i++) {
399399
if ($synchsafe) { // disregard MSB, effectively 7-bit bytes
400-
$intvalue = $intvalue | (ord($byteword{$i}) & 0x7F) << (($bytewordlen - 1 - $i) * 7);
400+
$intvalue = $intvalue | (ord($byteword[$i]) & 0x7F) << (($bytewordlen - 1 - $i) * 7);
401401
} else {
402-
$intvalue += ord($byteword{$i}) * pow(256, ($bytewordlen - 1 - $i));
402+
$intvalue += ord($byteword[$i]) * pow(256, ($bytewordlen - 1 - $i));
403403
}
404404
}
405405
if ($signed && !$synchsafe) {
@@ -435,7 +435,7 @@ function BigEndian2Bin($byteword) {
435435
$binvalue = '';
436436
$bytewordlen = strlen($byteword);
437437
for ($i = 0; $i < $bytewordlen; $i++) {
438-
$binvalue .= str_pad(decbin(ord($byteword{$i})), 8, '0', STR_PAD_LEFT);
438+
$binvalue .= str_pad(decbin(ord($byteword[$i])), 8, '0', STR_PAD_LEFT);
439439
}
440440
return $binvalue;
441441
}
@@ -562,7 +562,7 @@ function Unsynchronise($data) {
562562
$data = str_replace(chr(0xFF).chr(0x00), chr(0xFF).chr(0x00).chr(0x00), $data);
563563
$unsyncheddata = '';
564564
for ($i = 0; $i < strlen($data); $i++) {
565-
$thischar = $data{$i};
565+
$thischar = $data[$i];
566566
$unsyncheddata .= $thischar;
567567
if ($thischar == chr(255)) {
568568
$nextchar = ord(substr($data, $i + 1, 1));
@@ -677,8 +677,8 @@ function RoughTranslateUnicodeToASCII($rawdata, $frame_textencoding) {
677677
$asciidata = substr($asciidata, 0, strlen($asciidata) - 2); // remove terminator, only if present (it should be, but...)
678678
}
679679
for ($i = 0; $i < strlen($asciidata); $i += 2) {
680-
if ((ord($asciidata{$i}) <= 0x7F) || (ord($asciidata{$i}) >= 0xA0)) {
681-
$tempstring .= $asciidata{$i};
680+
if ((ord($asciidata[$i]) <= 0x7F) || (ord($asciidata[$i]) >= 0xA0)) {
681+
$tempstring .= $asciidata[$i];
682682
} else {
683683
$tempstring .= '?';
684684
}
@@ -692,8 +692,8 @@ function RoughTranslateUnicodeToASCII($rawdata, $frame_textencoding) {
692692
$asciidata = substr($asciidata, 0, strlen($asciidata) - 2); // remove terminator, only if present (it should be, but...)
693693
}
694694
for ($i = 0; $i < strlen($asciidata); $i += 2) {
695-
if ((ord($asciidata{$i}) <= 0x7F) || (ord($asciidata{$i}) >= 0xA0)) {
696-
$tempstring .= $asciidata{$i};
695+
if ((ord($asciidata[$i]) <= 0x7F) || (ord($asciidata[$i]) >= 0xA0)) {
696+
$tempstring .= $asciidata[$i];
697697
} else {
698698
$tempstring .= '?';
699699
}
@@ -711,8 +711,8 @@ function RoughTranslateUnicodeToASCII($rawdata, $frame_textencoding) {
711711
$asciidata = substr($asciidata, 0, strlen($asciidata) - 2); // remove terminator, only if present (it should be, but...)
712712
}
713713
for ($i = 0; ($i + 1) < strlen($asciidata); $i += 2) {
714-
if ((ord($asciidata{($i + 1)}) <= 0x7F) || (ord($asciidata{($i + 1)}) >= 0xA0)) {
715-
$tempstring .= $asciidata{($i + 1)};
714+
if ((ord($asciidata[($i + 1)]) <= 0x7F) || (ord($asciidata[($i + 1)]) >= 0xA0)) {
715+
$tempstring .= $asciidata[($i + 1)];
716716
} else {
717717
$tempstring .= '?';
718718
}
@@ -850,26 +850,26 @@ function GUIDtoBytestring($GUIDstring) {
850850

851851
if (!function_exists('BytestringToGUID')) {
852852
function BytestringToGUID($Bytestring) {
853-
$GUIDstring = str_pad(dechex(ord($Bytestring{3})), 2, '0', STR_PAD_LEFT);
854-
$GUIDstring .= str_pad(dechex(ord($Bytestring{2})), 2, '0', STR_PAD_LEFT);
855-
$GUIDstring .= str_pad(dechex(ord($Bytestring{1})), 2, '0', STR_PAD_LEFT);
856-
$GUIDstring .= str_pad(dechex(ord($Bytestring{0})), 2, '0', STR_PAD_LEFT);
853+
$GUIDstring = str_pad(dechex(ord($Bytestring[3])), 2, '0', STR_PAD_LEFT);
854+
$GUIDstring .= str_pad(dechex(ord($Bytestring[2])), 2, '0', STR_PAD_LEFT);
855+
$GUIDstring .= str_pad(dechex(ord($Bytestring[1])), 2, '0', STR_PAD_LEFT);
856+
$GUIDstring .= str_pad(dechex(ord($Bytestring[0])), 2, '0', STR_PAD_LEFT);
857857
$GUIDstring .= '-';
858-
$GUIDstring .= str_pad(dechex(ord($Bytestring{5})), 2, '0', STR_PAD_LEFT);
859-
$GUIDstring .= str_pad(dechex(ord($Bytestring{4})), 2, '0', STR_PAD_LEFT);
858+
$GUIDstring .= str_pad(dechex(ord($Bytestring[5])), 2, '0', STR_PAD_LEFT);
859+
$GUIDstring .= str_pad(dechex(ord($Bytestring[4])), 2, '0', STR_PAD_LEFT);
860860
$GUIDstring .= '-';
861-
$GUIDstring .= str_pad(dechex(ord($Bytestring{7})), 2, '0', STR_PAD_LEFT);
862-
$GUIDstring .= str_pad(dechex(ord($Bytestring{6})), 2, '0', STR_PAD_LEFT);
861+
$GUIDstring .= str_pad(dechex(ord($Bytestring[7])), 2, '0', STR_PAD_LEFT);
862+
$GUIDstring .= str_pad(dechex(ord($Bytestring[6])), 2, '0', STR_PAD_LEFT);
863863
$GUIDstring .= '-';
864-
$GUIDstring .= str_pad(dechex(ord($Bytestring{8})), 2, '0', STR_PAD_LEFT);
865-
$GUIDstring .= str_pad(dechex(ord($Bytestring{9})), 2, '0', STR_PAD_LEFT);
864+
$GUIDstring .= str_pad(dechex(ord($Bytestring[8])), 2, '0', STR_PAD_LEFT);
865+
$GUIDstring .= str_pad(dechex(ord($Bytestring[9])), 2, '0', STR_PAD_LEFT);
866866
$GUIDstring .= '-';
867-
$GUIDstring .= str_pad(dechex(ord($Bytestring{10})), 2, '0', STR_PAD_LEFT);
868-
$GUIDstring .= str_pad(dechex(ord($Bytestring{11})), 2, '0', STR_PAD_LEFT);
869-
$GUIDstring .= str_pad(dechex(ord($Bytestring{12})), 2, '0', STR_PAD_LEFT);
870-
$GUIDstring .= str_pad(dechex(ord($Bytestring{13})), 2, '0', STR_PAD_LEFT);
871-
$GUIDstring .= str_pad(dechex(ord($Bytestring{14})), 2, '0', STR_PAD_LEFT);
872-
$GUIDstring .= str_pad(dechex(ord($Bytestring{15})), 2, '0', STR_PAD_LEFT);
867+
$GUIDstring .= str_pad(dechex(ord($Bytestring[10])), 2, '0', STR_PAD_LEFT);
868+
$GUIDstring .= str_pad(dechex(ord($Bytestring[11])), 2, '0', STR_PAD_LEFT);
869+
$GUIDstring .= str_pad(dechex(ord($Bytestring[12])), 2, '0', STR_PAD_LEFT);
870+
$GUIDstring .= str_pad(dechex(ord($Bytestring[13])), 2, '0', STR_PAD_LEFT);
871+
$GUIDstring .= str_pad(dechex(ord($Bytestring[14])), 2, '0', STR_PAD_LEFT);
872+
$GUIDstring .= str_pad(dechex(ord($Bytestring[15])), 2, '0', STR_PAD_LEFT);
873873

874874
return strtoupper($GUIDstring);
875875
}
@@ -940,17 +940,17 @@ function utf8_decode($utf8text) {
940940
$utf8length = strlen($utf8text);
941941
$decodedtext = '';
942942
for ($i = 0; $i < $utf8length; $i++) {
943-
if ((ord($utf8text{$i}) & 0x80) == 0) {
944-
$decodedtext .= $utf8text{$i};
945-
} elseif ((ord($utf8text{$i}) & 0xF0) == 0xF0) {
943+
if ((ord($utf8text[$i]) & 0x80) == 0) {
944+
$decodedtext .= $utf8text[$i];
945+
} elseif ((ord($utf8text[$i]) & 0xF0) == 0xF0) {
946946
$decodedtext .= '?';
947947
$i += 3;
948-
} elseif ((ord($utf8text{$i}) & 0xE0) == 0xE0) {
948+
} elseif ((ord($utf8text[$i]) & 0xE0) == 0xE0) {
949949
$decodedtext .= '?';
950950
$i += 2;
951-
} elseif ((ord($utf8text{$i}) & 0xC0) == 0xC0) {
951+
} elseif ((ord($utf8text[$i]) & 0xC0) == 0xC0) {
952952
// 2 11 110bbbbb 10bbbbbb
953-
$decodedchar = Bin2Dec(substr(Dec2Bin(ord($utf8text{$i})), 3, 5).substr(Dec2Bin(ord($utf8text{($i + 1)})), 2, 6));
953+
$decodedchar = Bin2Dec(substr(Dec2Bin(ord($utf8text[$i])), 3, 5).substr(Dec2Bin(ord($utf8text[($i + 1)])), 2, 6));
954954
if ($decodedchar <= 255) {
955955
$decodedtext .= chr($decodedchar);
956956
} else {
@@ -1068,7 +1068,7 @@ function CreateDeepArray($ArrayPath, $Separator, $Value) {
10681068
// $foo = array('path'=>array('to'=>'array('my'=>array('file.txt'))));
10691069
// or
10701070
// $foo['path']['to']['my'] = 'file.txt';
1071-
while ($ArrayPath{0} == $Separator) {
1071+
while ($ArrayPath[0] == $Separator) {
10721072
$ArrayPath = substr($ArrayPath, 1);
10731073
}
10741074
if (($pos = strpos($ArrayPath, $Separator)) !== false) {
@@ -1916,7 +1916,7 @@ function decodeMPEGaudioHeader($fd, $offset, &$ThisFileInfo, $recursivesearch=tr
19161916
if ($ThisFileInfo['mpeg']['audio']['xing_flags']['toc']) {
19171917
$LAMEtocData = substr($headerstring, $VBRidOffset + 16, 100);
19181918
for ($i = 0; $i < 100; $i++) {
1919-
$ThisFileInfo['mpeg']['audio']['toc'][$i] = ord($LAMEtocData{$i});
1919+
$ThisFileInfo['mpeg']['audio']['toc'][$i] = ord($LAMEtocData[$i]);
19201920
}
19211921
}
19221922
if ($ThisFileInfo['mpeg']['audio']['xing_flags']['vbr_scale']) {
@@ -2297,9 +2297,9 @@ function FreeFormatFrameLength($fd, $offset, &$ThisFileInfo, $deepscan=false) {
22972297

22982298
$SyncPattern1 = substr($MPEGaudioData, 0, 4);
22992299
// may be different pattern due to padding
2300-
$SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) | 0x02).$SyncPattern1{3};
2300+
$SyncPattern2 = $SyncPattern1[0].$SyncPattern1[1].chr(ord($SyncPattern1[2]) | 0x02).$SyncPattern1[3];
23012301
if ($SyncPattern2 === $SyncPattern1) {
2302-
$SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) & 0xFD).$SyncPattern1{3};
2302+
$SyncPattern2 = $SyncPattern1[0].$SyncPattern1[1].chr(ord($SyncPattern1[2]) & 0xFD).$SyncPattern1[3];
23032303
}
23042304

23052305
$framelength = false;
@@ -2435,7 +2435,7 @@ function getOnlyMPEGaudioInfo($fd, &$ThisFileInfo, $avdataoffset, $BitrateHistog
24352435
return false;
24362436
}
24372437

2438-
if (($header{$SynchSeekOffset} == CONST_FF) && ($header{($SynchSeekOffset + 1)} > CONST_E0)) { // synch detected
2438+
if (($header[$SynchSeekOffset] == CONST_FF) && ($header[($SynchSeekOffset + 1)] > CONST_E0)) { // synch detected
24392439

24402440
if (!isset($FirstFrameThisfileInfo) && !isset($ThisFileInfo['mpeg']['audio'])) {
24412441
$FirstFrameThisfileInfo = $ThisFileInfo;
@@ -2764,18 +2764,18 @@ function MPEGaudioHeaderDecode($Header4Bytes) {
27642764
}
27652765

27662766
$MPEGrawHeader['synch'] = (BigEndian2Int(substr($Header4Bytes, 0, 2)) & 0xFFE0) >> 4;
2767-
$MPEGrawHeader['version'] = (ord($Header4Bytes{1}) & 0x18) >> 3; // BB
2768-
$MPEGrawHeader['layer'] = (ord($Header4Bytes{1}) & 0x06) >> 1; // CC
2769-
$MPEGrawHeader['protection'] = (ord($Header4Bytes{1}) & 0x01); // D
2770-
$MPEGrawHeader['bitrate'] = (ord($Header4Bytes{2}) & 0xF0) >> 4; // EEEE
2771-
$MPEGrawHeader['sample_rate'] = (ord($Header4Bytes{2}) & 0x0C) >> 2; // FF
2772-
$MPEGrawHeader['padding'] = (ord($Header4Bytes{2}) & 0x02) >> 1; // G
2773-
$MPEGrawHeader['private'] = (ord($Header4Bytes{2}) & 0x01); // H
2774-
$MPEGrawHeader['channelmode'] = (ord($Header4Bytes{3}) & 0xC0) >> 6; // II
2775-
$MPEGrawHeader['modeextension'] = (ord($Header4Bytes{3}) & 0x30) >> 4; // JJ
2776-
$MPEGrawHeader['copyright'] = (ord($Header4Bytes{3}) & 0x08) >> 3; // K
2777-
$MPEGrawHeader['original'] = (ord($Header4Bytes{3}) & 0x04) >> 2; // L
2778-
$MPEGrawHeader['emphasis'] = (ord($Header4Bytes{3}) & 0x03); // MM
2767+
$MPEGrawHeader['version'] = (ord($Header4Bytes[1]) & 0x18) >> 3; // BB
2768+
$MPEGrawHeader['layer'] = (ord($Header4Bytes[1]) & 0x06) >> 1; // CC
2769+
$MPEGrawHeader['protection'] = (ord($Header4Bytes[1]) & 0x01); // D
2770+
$MPEGrawHeader['bitrate'] = (ord($Header4Bytes[2]) & 0xF0) >> 4; // EEEE
2771+
$MPEGrawHeader['sample_rate'] = (ord($Header4Bytes[2]) & 0x0C) >> 2; // FF
2772+
$MPEGrawHeader['padding'] = (ord($Header4Bytes[2]) & 0x02) >> 1; // G
2773+
$MPEGrawHeader['private'] = (ord($Header4Bytes[2]) & 0x01); // H
2774+
$MPEGrawHeader['channelmode'] = (ord($Header4Bytes[3]) & 0xC0) >> 6; // II
2775+
$MPEGrawHeader['modeextension'] = (ord($Header4Bytes[3]) & 0x30) >> 4; // JJ
2776+
$MPEGrawHeader['copyright'] = (ord($Header4Bytes[3]) & 0x08) >> 3; // K
2777+
$MPEGrawHeader['original'] = (ord($Header4Bytes[3]) & 0x04) >> 2; // L
2778+
$MPEGrawHeader['emphasis'] = (ord($Header4Bytes[3]) & 0x03); // MM
27792779

27802780
return $MPEGrawHeader;
27812781
}

demos/demo.mysql.php

+16-16
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ function SynchronizeAllTags($filename, $synchronizefrom='all', $synchronizeto='A
504504

505505
$ParenthesesPairs = array('()', '[]', '{}');
506506
foreach ($ParenthesesPairs as $pair) {
507-
if (preg_match_all('/(.*) '.preg_quote($pair{0}).'(([^'.preg_quote($pair).']*[\- '.preg_quote($pair{0}).'])?(cut|dub|edit|version|live|reprise|[a-z]*mix))'.preg_quote($pair{1}).'/iU', $this_track_title, $matches)) {
507+
if (preg_match_all('/(.*) '.preg_quote($pair[0]).'(([^'.preg_quote($pair).']*[\- '.preg_quote($pair[0]).'])?(cut|dub|edit|version|live|reprise|[a-z]*mix))'.preg_quote($pair[1]).'/iU', $this_track_title, $matches)) {
508508
$this_track_title = $matches[1][0];
509509
$this_track_remix = implode("\t", $matches[2]);
510510
}
@@ -1352,10 +1352,10 @@ function SynchronizeAllTags($filename, $synchronizefrom='all', $synchronizeto='A
13521352
set_time_limit(10);
13531353
$PatternFilename = '';
13541354
for ($i = 0; $i < $PatternLength; $i++) {
1355-
if (isset($patterns[$Pattern{$i}])) {
1356-
$PatternFilename .= trim(strtr($row[$patterns[$Pattern{$i}]], ':\\*<>|', ';-¤«»¦'), ' ');
1355+
if (isset($patterns[$Pattern[$i]])) {
1356+
$PatternFilename .= trim(strtr($row[$patterns[$Pattern[$i]]], ':\\*<>|', ';-¤«»¦'), ' ');
13571357
} else {
1358-
$PatternFilename .= $Pattern{$i};
1358+
$PatternFilename .= $Pattern[$i];
13591359
}
13601360
}
13611361

@@ -1379,15 +1379,15 @@ function SynchronizeAllTags($filename, $synchronizefrom='all', $synchronizeto='A
13791379

13801380
// multiple remixes are stored tab-seperated in the database.
13811381
// change "{2000 Version\tSomebody Remix}" into "{2000 Version} {Somebody Remix}"
1382-
while (preg_match('#^(.*)'.preg_quote($pair{0}).'([^'.preg_quote($pair{1}).']*)('."\t".')([^'.preg_quote($pair{0}).']*)'.preg_quote($pair{1}).'#', $PatternFilename, $matches)) {
1383-
$PatternFilename = $matches[1].$pair{0}.$matches[2].$pair{1}.' '.$pair{0}.$matches[4].$pair{1};
1382+
while (preg_match('#^(.*)'.preg_quote($pair[0]).'([^'.preg_quote($pair[1]).']*)('."\t".')([^'.preg_quote($pair[0]).']*)'.preg_quote($pair[1]).'#', $PatternFilename, $matches)) {
1383+
$PatternFilename = $matches[1].$pair[0].$matches[2].$pair[1].' '.$pair[0].$matches[4].$pair[1];
13841384
}
13851385

13861386
// remove empty parenthesized pairs (probably where no track numbers, remix version, etc)
13871387
$PatternFilename = preg_replace('#'.preg_quote($pair).'#', '', $PatternFilename);
13881388

13891389
// "[01] - Title With No Artist.mp3" ==> "[01] Title With No Artist.mp3"
1390-
$PatternFilename = preg_replace('#'.preg_quote($pair{1}).' +\- #', $pair{1}.' ', $PatternFilename);
1390+
$PatternFilename = preg_replace('#'.preg_quote($pair[1]).' +\- #', $pair[1].' ', $PatternFilename);
13911391

13921392
}
13931393

@@ -1421,7 +1421,7 @@ function SynchronizeAllTags($filename, $synchronizefrom='all', $synchronizeto='A
14211421
} else {
14221422
$ShortestNameLength = min(strlen($ActualFilenameNoExt), strlen($PatternFilenameNoExt));
14231423
for ($DifferenceOffset = 0; $DifferenceOffset < $ShortestNameLength; $DifferenceOffset++) {
1424-
if ($ActualFilenameNoExt{$DifferenceOffset} !== $PatternFilenameNoExt{$DifferenceOffset}) {
1424+
if ($ActualFilenameNoExt[$DifferenceOffset] !== $PatternFilenameNoExt[$DifferenceOffset]) {
14251425
break;
14261426
}
14271427
}
@@ -2090,15 +2090,15 @@ function CleanUpFileName($filename) {
20902090
function BetterUCwords($string) {
20912091
$stringlength = strlen($string);
20922092

2093-
$string{0} = strtoupper($string{0});
2093+
$string[0] = strtoupper($string[0]);
20942094
for ($i = 1; $i < $stringlength; $i++) {
2095-
if (($string{$i - 1} == '\'') && ($i > 1) && (($string{$i - 2} == 'O') || ($string{$i - 2} == ' '))) {
2095+
if (($string[$i - 1] == '\'') && ($i > 1) && (($string[$i - 2] == 'O') || ($string[$i - 2] == ' '))) {
20962096
// O'Clock, 'Em
2097-
$string{$i} = strtoupper($string{$i});
2098-
} elseif (preg_match('#^[\'A-Za-z0-9À-ÿ]$#', $string{$i - 1})) {
2099-
$string{$i} = strtolower($string{$i});
2097+
$string[$i] = strtoupper($string[$i]);
2098+
} elseif (preg_match('#^[\'A-Za-z0-9À-ÿ]$#', $string[$i - 1])) {
2099+
$string[$i] = strtolower($string[$i]);
21002100
} else {
2101-
$string{$i} = strtoupper($string{$i});
2101+
$string[$i] = strtoupper($string[$i]);
21022102
}
21032103
}
21042104

@@ -2113,9 +2113,9 @@ function BetterUCwords($string) {
21132113
} elseif (in_array(strtoupper(str_replace('(', '', $ThisWord)), $UpperCaseWords)) {
21142114
$ThisWord = strtoupper($ThisWord);
21152115
} elseif ((substr($ThisWord, 0, 2) == 'Mc') && (strlen($ThisWord) > 2)) {
2116-
$ThisWord{2} = strtoupper($ThisWord{2});
2116+
$ThisWord[2] = strtoupper($ThisWord[2]);
21172117
} elseif ((substr($ThisWord, 0, 3) == 'Mac') && (strlen($ThisWord) > 3)) {
2118-
$ThisWord{3} = strtoupper($ThisWord{3});
2118+
$ThisWord[3] = strtoupper($ThisWord[3]);
21192119
}
21202120
$OutputListOfWords[] = $ThisWord;
21212121
}

src/GetID3.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ public function analyze($filename, $filesize=null, $original_filename='', $fp=nu
412412
$header = fread($this->fp, 10);
413413
if ((substr($header, 0, 3) == 'ID3') && (strlen($header) == 10)) {
414414
$this->info['id3v2']['header'] = true;
415-
$this->info['id3v2']['majorversion'] = ord($header{3});
416-
$this->info['id3v2']['minorversion'] = ord($header{4});
415+
$this->info['id3v2']['majorversion'] = ord($header[3]);
416+
$this->info['id3v2']['minorversion'] = ord($header[4]);
417417
$this->info['avdataoffset'] += Utils::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length
418418
}
419419
}

src/Module/Archive/Tar.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ public function Analyze() {
4747
// check the block
4848
$checksum = 0;
4949
for ($i = 0; $i < 148; $i++) {
50-
$checksum += ord($buffer{$i});
50+
$checksum += ord($buffer[$i]);
5151
}
5252
for ($i = 148; $i < 156; $i++) {
5353
$checksum += ord(' ');
5454
}
5555
for ($i = 156; $i < 512; $i++) {
56-
$checksum += ord($buffer{$i});
56+
$checksum += ord($buffer[$i]);
5757
}
5858
$attr = unpack($unpack_header, $buffer);
5959
$name = (isset($attr['fname'] ) ? trim($attr['fname'] ) : '');

src/Module/Audio/Ac3.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ public static function heavyCompression($compre) {
690690
// -8 -42.14 dB
691691

692692
$fourbit = str_pad(decbin(($compre & 0xF0) >> 4), 4, '0', STR_PAD_LEFT);
693-
if ($fourbit{0} == '1') {
693+
if ($fourbit[0] == '1') {
694694
$log_gain = -8 + bindec(substr($fourbit, 1));
695695
} else {
696696
$log_gain = bindec(substr($fourbit, 1));

0 commit comments

Comments
 (0)