Skip to content

Commit

Permalink
Merge pull request #195 from jrfnl/feature/2.0/php-7.4-fix-deprecated…
Browse files Browse the repository at this point in the history
…-curly-brace-array-access

[2.0] PHP 7.4 compatibility: fix deprecated curly brace array access
  • Loading branch information
JamesHeinrich committed Jul 22, 2019
2 parents 0e1fa0e + 943f6cb commit 8cf765e
Show file tree
Hide file tree
Showing 23 changed files with 242 additions and 242 deletions.
2 changes: 1 addition & 1 deletion demos/demo.browse.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
$deletefilemessage = 'FAILED to delete '.$_REQUEST['deletefile'].' - file does not exist';
}
if (isset($_REQUEST['noalert'])) {
echo '<span style="font-weight: bold; color: #'.(($deletefilemessage{0} == 'F') ? 'FF0000' : '008000').';">'.htmlentities($deletefilemessage, ENT_QUOTES).'</span><hr>';
echo '<span style="font-weight: bold; color: #'.(($deletefilemessage[0] == 'F') ? 'FF0000' : '008000').';">'.htmlentities($deletefilemessage, ENT_QUOTES).'</span><hr>';
} else {
echo '<script type="text/javascript">alert("'.addslashes($deletefilemessage).'");</script>';
}
Expand Down
112 changes: 56 additions & 56 deletions demos/demo.mp3header.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ function table_var_dump($variable) {
$variable = str_replace(chr(0), ' ', $variable);
$varlen = strlen($variable);
for ($i = 0; $i < $varlen; $i++) {
if (preg_match('#['.chr(0x0A).chr(0x0D).' -;0-9A-Za-z]#', $variable{$i})) {
$returnstring .= $variable{$i};
if (preg_match('#['.chr(0x0A).chr(0x0D).' -;0-9A-Za-z]#', $variable[$i])) {
$returnstring .= $variable[$i];
} else {
$returnstring .= '&#'.str_pad(ord($variable{$i}), 3, '0', STR_PAD_LEFT).';';
$returnstring .= '&#'.str_pad(ord($variable[$i]), 3, '0', STR_PAD_LEFT).';';
}
}
$returnstring = nl2br($returnstring);
Expand Down Expand Up @@ -242,19 +242,19 @@ function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) {
// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html
if (strpos($binarypointnumber, '.') === false) {
$binarypointnumber = '0.'.$binarypointnumber;
} elseif ($binarypointnumber{0} == '.') {
} elseif ($binarypointnumber[0] == '.') {
$binarypointnumber = '0'.$binarypointnumber;
}
$exponent = 0;
while (($binarypointnumber{0} != '1') || (substr($binarypointnumber, 1, 1) != '.')) {
while (($binarypointnumber[0] != '1') || (substr($binarypointnumber, 1, 1) != '.')) {
if (substr($binarypointnumber, 1, 1) == '.') {
$exponent--;
$binarypointnumber = substr($binarypointnumber, 2, 1).'.'.substr($binarypointnumber, 3);
} else {
$pointpos = strpos($binarypointnumber, '.');
$exponent += ($pointpos - 1);
$binarypointnumber = str_replace('.', '', $binarypointnumber);
$binarypointnumber = $binarypointnumber{0}.'.'.substr($binarypointnumber, 1);
$binarypointnumber = $binarypointnumber[0].'.'.substr($binarypointnumber, 1);
}
}
$binarypointnumber = str_pad(substr($binarypointnumber, 0, $maxbits + 2), $maxbits + 2, '0', STR_PAD_RIGHT);
Expand Down Expand Up @@ -324,7 +324,7 @@ function BigEndian2Float($byteword) {
// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee.html

$bitword = BigEndian2Bin($byteword);
$signbit = $bitword{0};
$signbit = $bitword[0];

switch (strlen($byteword) * 8) {
case 32:
Expand Down Expand Up @@ -397,9 +397,9 @@ function BigEndian2Int($byteword, $synchsafe=false, $signed=false) {
$bytewordlen = strlen($byteword);
for ($i = 0; $i < $bytewordlen; $i++) {
if ($synchsafe) { // disregard MSB, effectively 7-bit bytes
$intvalue = $intvalue | (ord($byteword{$i}) & 0x7F) << (($bytewordlen - 1 - $i) * 7);
$intvalue = $intvalue | (ord($byteword[$i]) & 0x7F) << (($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) {
Expand Down Expand Up @@ -435,7 +435,7 @@ function BigEndian2Bin($byteword) {
$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;
}
Expand Down Expand Up @@ -562,7 +562,7 @@ function Unsynchronise($data) {
$data = str_replace(chr(0xFF).chr(0x00), chr(0xFF).chr(0x00).chr(0x00), $data);
$unsyncheddata = '';
for ($i = 0; $i < strlen($data); $i++) {
$thischar = $data{$i};
$thischar = $data[$i];
$unsyncheddata .= $thischar;
if ($thischar == chr(255)) {
$nextchar = ord(substr($data, $i + 1, 1));
Expand Down Expand Up @@ -677,8 +677,8 @@ function RoughTranslateUnicodeToASCII($rawdata, $frame_textencoding) {
$asciidata = substr($asciidata, 0, strlen($asciidata) - 2); // remove terminator, only if present (it should be, but...)
}
for ($i = 0; $i < strlen($asciidata); $i += 2) {
if ((ord($asciidata{$i}) <= 0x7F) || (ord($asciidata{$i}) >= 0xA0)) {
$tempstring .= $asciidata{$i};
if ((ord($asciidata[$i]) <= 0x7F) || (ord($asciidata[$i]) >= 0xA0)) {
$tempstring .= $asciidata[$i];
} else {
$tempstring .= '?';
}
Expand All @@ -692,8 +692,8 @@ function RoughTranslateUnicodeToASCII($rawdata, $frame_textencoding) {
$asciidata = substr($asciidata, 0, strlen($asciidata) - 2); // remove terminator, only if present (it should be, but...)
}
for ($i = 0; $i < strlen($asciidata); $i += 2) {
if ((ord($asciidata{$i}) <= 0x7F) || (ord($asciidata{$i}) >= 0xA0)) {
$tempstring .= $asciidata{$i};
if ((ord($asciidata[$i]) <= 0x7F) || (ord($asciidata[$i]) >= 0xA0)) {
$tempstring .= $asciidata[$i];
} else {
$tempstring .= '?';
}
Expand All @@ -711,8 +711,8 @@ function RoughTranslateUnicodeToASCII($rawdata, $frame_textencoding) {
$asciidata = substr($asciidata, 0, strlen($asciidata) - 2); // remove terminator, only if present (it should be, but...)
}
for ($i = 0; ($i + 1) < strlen($asciidata); $i += 2) {
if ((ord($asciidata{($i + 1)}) <= 0x7F) || (ord($asciidata{($i + 1)}) >= 0xA0)) {
$tempstring .= $asciidata{($i + 1)};
if ((ord($asciidata[($i + 1)]) <= 0x7F) || (ord($asciidata[($i + 1)]) >= 0xA0)) {
$tempstring .= $asciidata[($i + 1)];
} else {
$tempstring .= '?';
}
Expand Down Expand Up @@ -850,26 +850,26 @@ function GUIDtoBytestring($GUIDstring) {

if (!function_exists('BytestringToGUID')) {
function BytestringToGUID($Bytestring) {
$GUIDstring = str_pad(dechex(ord($Bytestring{3})), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring{2})), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring{1})), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring{0})), 2, '0', STR_PAD_LEFT);
$GUIDstring = str_pad(dechex(ord($Bytestring[3])), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring[2])), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring[1])), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring[0])), 2, '0', STR_PAD_LEFT);
$GUIDstring .= '-';
$GUIDstring .= str_pad(dechex(ord($Bytestring{5})), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring{4})), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring[5])), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring[4])), 2, '0', STR_PAD_LEFT);
$GUIDstring .= '-';
$GUIDstring .= str_pad(dechex(ord($Bytestring{7})), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring{6})), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring[7])), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring[6])), 2, '0', STR_PAD_LEFT);
$GUIDstring .= '-';
$GUIDstring .= str_pad(dechex(ord($Bytestring{8})), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring{9})), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring[8])), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring[9])), 2, '0', STR_PAD_LEFT);
$GUIDstring .= '-';
$GUIDstring .= str_pad(dechex(ord($Bytestring{10})), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring{11})), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring{12})), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring{13})), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring{14})), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring{15})), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring[10])), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring[11])), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring[12])), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring[13])), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring[14])), 2, '0', STR_PAD_LEFT);
$GUIDstring .= str_pad(dechex(ord($Bytestring[15])), 2, '0', STR_PAD_LEFT);

return strtoupper($GUIDstring);
}
Expand Down Expand Up @@ -940,17 +940,17 @@ function utf8_decode($utf8text) {
$utf8length = strlen($utf8text);
$decodedtext = '';
for ($i = 0; $i < $utf8length; $i++) {
if ((ord($utf8text{$i}) & 0x80) == 0) {
$decodedtext .= $utf8text{$i};
} elseif ((ord($utf8text{$i}) & 0xF0) == 0xF0) {
if ((ord($utf8text[$i]) & 0x80) == 0) {
$decodedtext .= $utf8text[$i];
} elseif ((ord($utf8text[$i]) & 0xF0) == 0xF0) {
$decodedtext .= '?';
$i += 3;
} elseif ((ord($utf8text{$i}) & 0xE0) == 0xE0) {
} elseif ((ord($utf8text[$i]) & 0xE0) == 0xE0) {
$decodedtext .= '?';
$i += 2;
} elseif ((ord($utf8text{$i}) & 0xC0) == 0xC0) {
} elseif ((ord($utf8text[$i]) & 0xC0) == 0xC0) {
// 2 11 110bbbbb 10bbbbbb
$decodedchar = Bin2Dec(substr(Dec2Bin(ord($utf8text{$i})), 3, 5).substr(Dec2Bin(ord($utf8text{($i + 1)})), 2, 6));
$decodedchar = Bin2Dec(substr(Dec2Bin(ord($utf8text[$i])), 3, 5).substr(Dec2Bin(ord($utf8text[($i + 1)])), 2, 6));
if ($decodedchar <= 255) {
$decodedtext .= chr($decodedchar);
} else {
Expand Down Expand Up @@ -1068,7 +1068,7 @@ function CreateDeepArray($ArrayPath, $Separator, $Value) {
// $foo = array('path'=>array('to'=>'array('my'=>array('file.txt'))));
// or
// $foo['path']['to']['my'] = 'file.txt';
while ($ArrayPath{0} == $Separator) {
while ($ArrayPath[0] == $Separator) {
$ArrayPath = substr($ArrayPath, 1);
}
if (($pos = strpos($ArrayPath, $Separator)) !== false) {
Expand Down Expand Up @@ -1916,7 +1916,7 @@ function decodeMPEGaudioHeader($fd, $offset, &$ThisFileInfo, $recursivesearch=tr
if ($ThisFileInfo['mpeg']['audio']['xing_flags']['toc']) {
$LAMEtocData = substr($headerstring, $VBRidOffset + 16, 100);
for ($i = 0; $i < 100; $i++) {
$ThisFileInfo['mpeg']['audio']['toc'][$i] = ord($LAMEtocData{$i});
$ThisFileInfo['mpeg']['audio']['toc'][$i] = ord($LAMEtocData[$i]);
}
}
if ($ThisFileInfo['mpeg']['audio']['xing_flags']['vbr_scale']) {
Expand Down Expand Up @@ -2297,9 +2297,9 @@ function FreeFormatFrameLength($fd, $offset, &$ThisFileInfo, $deepscan=false) {

$SyncPattern1 = substr($MPEGaudioData, 0, 4);
// may be different pattern due to padding
$SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) | 0x02).$SyncPattern1{3};
$SyncPattern2 = $SyncPattern1[0].$SyncPattern1[1].chr(ord($SyncPattern1[2]) | 0x02).$SyncPattern1[3];
if ($SyncPattern2 === $SyncPattern1) {
$SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) & 0xFD).$SyncPattern1{3};
$SyncPattern2 = $SyncPattern1[0].$SyncPattern1[1].chr(ord($SyncPattern1[2]) & 0xFD).$SyncPattern1[3];
}

$framelength = false;
Expand Down Expand Up @@ -2435,7 +2435,7 @@ function getOnlyMPEGaudioInfo($fd, &$ThisFileInfo, $avdataoffset, $BitrateHistog
return false;
}

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

if (!isset($FirstFrameThisfileInfo) && !isset($ThisFileInfo['mpeg']['audio'])) {
$FirstFrameThisfileInfo = $ThisFileInfo;
Expand Down Expand Up @@ -2764,18 +2764,18 @@ function MPEGaudioHeaderDecode($Header4Bytes) {
}

$MPEGrawHeader['synch'] = (BigEndian2Int(substr($Header4Bytes, 0, 2)) & 0xFFE0) >> 4;
$MPEGrawHeader['version'] = (ord($Header4Bytes{1}) & 0x18) >> 3; // BB
$MPEGrawHeader['layer'] = (ord($Header4Bytes{1}) & 0x06) >> 1; // CC
$MPEGrawHeader['protection'] = (ord($Header4Bytes{1}) & 0x01); // D
$MPEGrawHeader['bitrate'] = (ord($Header4Bytes{2}) & 0xF0) >> 4; // EEEE
$MPEGrawHeader['sample_rate'] = (ord($Header4Bytes{2}) & 0x0C) >> 2; // FF
$MPEGrawHeader['padding'] = (ord($Header4Bytes{2}) & 0x02) >> 1; // G
$MPEGrawHeader['private'] = (ord($Header4Bytes{2}) & 0x01); // H
$MPEGrawHeader['channelmode'] = (ord($Header4Bytes{3}) & 0xC0) >> 6; // II
$MPEGrawHeader['modeextension'] = (ord($Header4Bytes{3}) & 0x30) >> 4; // JJ
$MPEGrawHeader['copyright'] = (ord($Header4Bytes{3}) & 0x08) >> 3; // K
$MPEGrawHeader['original'] = (ord($Header4Bytes{3}) & 0x04) >> 2; // L
$MPEGrawHeader['emphasis'] = (ord($Header4Bytes{3}) & 0x03); // MM
$MPEGrawHeader['version'] = (ord($Header4Bytes[1]) & 0x18) >> 3; // BB
$MPEGrawHeader['layer'] = (ord($Header4Bytes[1]) & 0x06) >> 1; // CC
$MPEGrawHeader['protection'] = (ord($Header4Bytes[1]) & 0x01); // D
$MPEGrawHeader['bitrate'] = (ord($Header4Bytes[2]) & 0xF0) >> 4; // EEEE
$MPEGrawHeader['sample_rate'] = (ord($Header4Bytes[2]) & 0x0C) >> 2; // FF
$MPEGrawHeader['padding'] = (ord($Header4Bytes[2]) & 0x02) >> 1; // G
$MPEGrawHeader['private'] = (ord($Header4Bytes[2]) & 0x01); // H
$MPEGrawHeader['channelmode'] = (ord($Header4Bytes[3]) & 0xC0) >> 6; // II
$MPEGrawHeader['modeextension'] = (ord($Header4Bytes[3]) & 0x30) >> 4; // JJ
$MPEGrawHeader['copyright'] = (ord($Header4Bytes[3]) & 0x08) >> 3; // K
$MPEGrawHeader['original'] = (ord($Header4Bytes[3]) & 0x04) >> 2; // L
$MPEGrawHeader['emphasis'] = (ord($Header4Bytes[3]) & 0x03); // MM

return $MPEGrawHeader;
}
Expand Down
32 changes: 16 additions & 16 deletions demos/demo.mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ function SynchronizeAllTags($filename, $synchronizefrom='all', $synchronizeto='A

$ParenthesesPairs = array('()', '[]', '{}');
foreach ($ParenthesesPairs as $pair) {
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)) {
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)) {
$this_track_title = $matches[1][0];
$this_track_remix = implode("\t", $matches[2]);
}
Expand Down Expand Up @@ -1352,10 +1352,10 @@ function SynchronizeAllTags($filename, $synchronizefrom='all', $synchronizeto='A
set_time_limit(10);
$PatternFilename = '';
for ($i = 0; $i < $PatternLength; $i++) {
if (isset($patterns[$Pattern{$i}])) {
$PatternFilename .= trim(strtr($row[$patterns[$Pattern{$i}]], ':\\*<>|', ';-¤«»¦'), ' ');
if (isset($patterns[$Pattern[$i]])) {
$PatternFilename .= trim(strtr($row[$patterns[$Pattern[$i]]], ':\\*<>|', ';-¤«»¦'), ' ');
} else {
$PatternFilename .= $Pattern{$i};
$PatternFilename .= $Pattern[$i];
}
}

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

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

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

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

}

Expand Down Expand Up @@ -1421,7 +1421,7 @@ function SynchronizeAllTags($filename, $synchronizefrom='all', $synchronizeto='A
} else {
$ShortestNameLength = min(strlen($ActualFilenameNoExt), strlen($PatternFilenameNoExt));
for ($DifferenceOffset = 0; $DifferenceOffset < $ShortestNameLength; $DifferenceOffset++) {
if ($ActualFilenameNoExt{$DifferenceOffset} !== $PatternFilenameNoExt{$DifferenceOffset}) {
if ($ActualFilenameNoExt[$DifferenceOffset] !== $PatternFilenameNoExt[$DifferenceOffset]) {
break;
}
}
Expand Down Expand Up @@ -2090,15 +2090,15 @@ function CleanUpFileName($filename) {
function BetterUCwords($string) {
$stringlength = strlen($string);

$string{0} = strtoupper($string{0});
$string[0] = strtoupper($string[0]);
for ($i = 1; $i < $stringlength; $i++) {
if (($string{$i - 1} == '\'') && ($i > 1) && (($string{$i - 2} == 'O') || ($string{$i - 2} == ' '))) {
if (($string[$i - 1] == '\'') && ($i > 1) && (($string[$i - 2] == 'O') || ($string[$i - 2] == ' '))) {
// O'Clock, 'Em
$string{$i} = strtoupper($string{$i});
} elseif (preg_match('#^[\'A-Za-z0-9À-ÿ]$#', $string{$i - 1})) {
$string{$i} = strtolower($string{$i});
$string[$i] = strtoupper($string[$i]);
} elseif (preg_match('#^[\'A-Za-z0-9À-ÿ]$#', $string[$i - 1])) {
$string[$i] = strtolower($string[$i]);
} else {
$string{$i} = strtoupper($string{$i});
$string[$i] = strtoupper($string[$i]);
}
}
Expand All @@ -2113,9 +2113,9 @@ function BetterUCwords($string) {
} elseif (in_array(strtoupper(str_replace('(', '', $ThisWord)), $UpperCaseWords)) {
$ThisWord = strtoupper($ThisWord);
} elseif ((substr($ThisWord, 0, 2) == 'Mc') && (strlen($ThisWord) > 2)) {
$ThisWord{2} = strtoupper($ThisWord{2});
$ThisWord[2] = strtoupper($ThisWord[2]);
} elseif ((substr($ThisWord, 0, 3) == 'Mac') && (strlen($ThisWord) > 3)) {
$ThisWord{3} = strtoupper($ThisWord{3});
$ThisWord[3] = strtoupper($ThisWord[3]);
}
$OutputListOfWords[] = $ThisWord;
}
Expand Down
4 changes: 2 additions & 2 deletions src/GetID3.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ public function analyze($filename, $filesize=null, $original_filename='', $fp=nu
$header = fread($this->fp, 10);
if ((substr($header, 0, 3) == 'ID3') && (strlen($header) == 10)) {
$this->info['id3v2']['header'] = true;
$this->info['id3v2']['majorversion'] = ord($header{3});
$this->info['id3v2']['minorversion'] = ord($header{4});
$this->info['id3v2']['majorversion'] = ord($header[3]);
$this->info['id3v2']['minorversion'] = ord($header[4]);
$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
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Module/Archive/Tar.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ public function Analyze() {
// check the block
$checksum = 0;
for ($i = 0; $i < 148; $i++) {
$checksum += ord($buffer{$i});
$checksum += ord($buffer[$i]);
}
for ($i = 148; $i < 156; $i++) {
$checksum += ord(' ');
}
for ($i = 156; $i < 512; $i++) {
$checksum += ord($buffer{$i});
$checksum += ord($buffer[$i]);
}
$attr = unpack($unpack_header, $buffer);
$name = (isset($attr['fname'] ) ? trim($attr['fname'] ) : '');
Expand Down
2 changes: 1 addition & 1 deletion src/Module/Audio/Ac3.php
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ public static function heavyCompression($compre) {
// -8 -42.14 dB

$fourbit = str_pad(decbin(($compre & 0xF0) >> 4), 4, '0', STR_PAD_LEFT);
if ($fourbit{0} == '1') {
if ($fourbit[0] == '1') {
$log_gain = -8 + bindec(substr($fourbit, 1));
} else {
$log_gain = bindec(substr($fourbit, 1));
Expand Down
Loading

0 comments on commit 8cf765e

Please sign in to comment.