Skip to content

Commit 5ad7910

Browse files
authored
Merge pull request #346 from StudioMaX/2.0-with-fixes
Sync 2.x with 1.9.21-202109171300
2 parents 131d4ad + ae22592 commit 5ad7910

39 files changed

+1886
-469
lines changed

.github/workflows/continuous-integration.yml

+2-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ jobs:
66
lint:
77
name: "Lint"
88
runs-on: "ubuntu-latest"
9-
continue-on-error: ${{ matrix.experimental }}
109
strategy:
1110
fail-fast: false
1211
matrix:
@@ -20,21 +19,15 @@ jobs:
2019
- "7.3"
2120
- "7.4"
2221
- "8.0"
23-
experimental:
24-
- false
25-
include:
26-
- php-version: "8.1"
27-
experimental: true
28-
composer-options: "--ignore-platform-reqs"
22+
- "8.1"
2923
steps:
3024
- uses: "actions/checkout@v2"
3125
- uses: "shivammathur/setup-php@v2"
3226
with:
3327
php-version: "${{ matrix.php-version }}"
28+
ini-values: error_reporting=-1, display_errors=On
3429
coverage: "none"
3530
- uses: "ramsey/composer-install@v1"
36-
with:
37-
composer-options: "${{ matrix.composer-options }}"
3831
- name: "Run the linter"
3932
run: "composer lint -- --colors"
4033

changelog.txt

+36
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,42 @@
1818
Version History
1919
===============
2020

21+
1.9.21: [2021-09-22] James Heinrich :: 1.9.21-202109171300
22+
» add support for RIFF.guan
23+
¤ add ID3v1 genres 148-191
24+
¤ torrent files easy access key
25+
* bugfix #342 demo.mysqli.php XSS
26+
* bugfix #340 default quicktime.ReturnAtomData=false
27+
* bugfix #338 improved transliterated tag merging
28+
* bugfix #337 PHP 8.1 compatibility
29+
* bugfix #335 PHP 8.1 compatibility
30+
* bugfix #330 QuicktimeContentRatingLookup 'rtng'
31+
* bugfix #328 throw exception if a resource seek fails
32+
* bugfix #326 improved temporary path detection
33+
* bugfix #325 INF/NAN constants instead of float/string
34+
* bugfix #324 Nikon-specific atoms in QuickTime
35+
* bugfix #321 prevent errors on corrupt JPEGs
36+
* bugfix #319 prevent error in ZIP contents MIME detect
37+
* bugfix #315 ID3v2 USLT check for data length
38+
* bugfix #308 silence libxml deprecation warning
39+
* bugfix #304 undefined index: comments
40+
* bugfix #299 decbin type error in PHP8
41+
* bugfix #298 error scanning WAV via file pointer
42+
* bugfix #294 replace IMG_JPG with IMAGETYPE_JPEG
43+
* bugfix #292 PDFs take long time to parse
44+
* bugfix #291 divzero QuickTime with no playable content
45+
* bugfix #290 detect ID3v1 on minimal example files
46+
* bugfix #289 avoid crash on invalid TIFF
47+
* bugfix #287 mp3 CBR detected as VBR
48+
* bugfix #286 corrupt mp3 can cause slow scanning
49+
* bugfix #284 allow "0" as a value in tags
50+
* bugfix #283 array offset on value of type int
51+
* bugfix #277 ID3v2 add new Turkish Lira TRY
52+
* bugfix #270 demo.mysqli.php LONGBLOB
53+
* bugfix #266 fix possible endless loop on PNG
54+
* bugfix #257 undefined variables
55+
* bugfix #207 improved LAME version string parsing
56+
2157
1.9.20: [2020-06-30] James Heinrich :: 1.9.20-202006061653
2258
» add support for DSDIFF audio
2359
» add support for TAK lossess audio

demos/demo.mp3header.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ function Dec2Bin($number) {
474474
}
475475
$bytes[] = $number;
476476
$binstring = '';
477-
for ($i = 0; $i < count($bytes); $i++) {
478-
$binstring = (($i == count($bytes) - 1) ? decbin($bytes[$i]) : str_pad(decbin($bytes[$i]), 8, '0', STR_PAD_LEFT)).$binstring;
477+
foreach ($bytes as $i => $byte) {
478+
$binstring = (($i == count($bytes) - 1) ? decbin($byte) : str_pad(decbin($byte), 8, '0', STR_PAD_LEFT)).$binstring;
479479
}
480480
return $binstring;
481481
}
@@ -586,8 +586,8 @@ function is_hash($var) {
586586
if (is_array($var)) {
587587
$keys = array_keys($var);
588588
$all_num = true;
589-
for ($i = 0; $i < count($keys); $i++) {
590-
if (is_string($keys[$i])) {
589+
foreach ($keys as $key) {
590+
if (is_string($key)) {
591591
return true;
592592
}
593593
}

demos/demo.mysqli.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,7 @@ function SynchronizeAllTags($filename, $synchronizefrom='all', $synchronizeto='A
14951495
} else {
14961496

14971497
echo '<a href="'.htmlentities($_SERVER['PHP_SELF'].'?encoderoptionsdistribution=1').'">Show all Encoder Options</a><hr>';
1498-
echo 'Files with Encoder Options <b>'.$_REQUEST['showtagfiles'].'</b>:<br>';
1498+
echo 'Files with Encoder Options <b>'.htmlentities($_REQUEST['showtagfiles']).'</b>:<br>';
14991499
echo '<table border="1" cellspacing="0" cellpadding="3">';
15001500
while ($row = mysqli_fetch_array($result)) {
15011501
echo '<tr>';

src/Cache/Dbm.php

+1
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ public function clear_cache() {
226226
*/
227227
public function analyze($filename, $filesize=null, $original_filename='', $fp=null) {
228228

229+
$key = null;
229230
if (file_exists($filename)) {
230231

231232
// Calc key filename::mod_time::size - should be unique

src/GetID3.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class GetID3
226226
*
227227
* @var bool
228228
*/
229-
public $options_audiovideo_quicktime_ReturnAtomData = true;
229+
public $options_audiovideo_quicktime_ReturnAtomData = false;
230230

231231
/** audio-video.quicktime
232232
* return all parsed data from all atoms if true, otherwise just returned parsed metadata
@@ -319,7 +319,7 @@ class GetID3
319319
*/
320320
protected $startup_warning = '';
321321

322-
const VERSION = '2.0.x-202105131611';
322+
const VERSION = '2.0.x-202109171300';
323323
const FREAD_BUFFER_SIZE = 32768;
324324

325325
const ATTACHMENTS_NONE = false;

src/Module/Archive/Gzip.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function Analyze() {
5959
$num_members = 0;
6060
while (true) {
6161
$is_wrong_members = false;
62-
$num_members = intval(count($arr_members));
62+
$num_members = count($arr_members);
6363
for ($i = 0; $i < $num_members; $i++) {
6464
if (strlen($arr_members[$i]) == 0) {
6565
continue;
@@ -84,13 +84,13 @@ public function Analyze() {
8484

8585
$fpointer = 0;
8686
$idx = 0;
87-
for ($i = 0; $i < $num_members; $i++) {
88-
if (strlen($arr_members[$i]) == 0) {
87+
foreach ($arr_members as $member) {
88+
if (strlen($member) == 0) {
8989
continue;
9090
}
9191
$thisInfo = &$info['gzip']['member_header'][++$idx];
9292

93-
$buff = "\x1F\x8B\x08".$arr_members[$i];
93+
$buff = "\x1F\x8B\x08". $member;
9494

9595
$attr = unpack($unpack_header, substr($buff, 0, $start_length));
9696
$thisInfo['filemtime'] = Utils::LittleEndian2Int($attr['mtime']);

src/Module/Archive/Tar.php

+3
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ public function display_perms($mode) {
141141
else $type='u'; // UNKNOWN
142142

143143
// Determine permissions
144+
$owner = array();
145+
$group = array();
146+
$world = array();
144147
$owner['read'] = (($mode & 00400) ? 'r' : '-');
145148
$owner['write'] = (($mode & 00200) ? 'w' : '-');
146149
$owner['execute'] = (($mode & 00100) ? 'x' : '-');

src/Module/Archive/Zip.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ public function Analyze() {
121121
!empty($info['zip']['files']['docProps']['core.xml'])) {
122122
// http://technet.microsoft.com/en-us/library/cc179224.aspx
123123
$info['fileformat'] = 'zip.msoffice';
124-
if (!empty($ThisFileInfo['zip']['files']['ppt'])) {
124+
if (!empty($info['zip']['files']['ppt'])) {
125125
$info['mime_type'] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
126-
} elseif (!empty($ThisFileInfo['zip']['files']['xl'])) {
126+
} elseif (!empty($info['zip']['files']['xl'])) {
127127
$info['mime_type'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
128-
} elseif (!empty($ThisFileInfo['zip']['files']['word'])) {
128+
} elseif (!empty($info['zip']['files']['word'])) {
129129
$info['mime_type'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
130130
}
131131
}
@@ -231,6 +231,7 @@ public function getZIPentriesFilepointer() {
231231
* @return array|false
232232
*/
233233
public function ZIPparseLocalFileHeader() {
234+
$LocalFileHeader = array();
234235
$LocalFileHeader['offset'] = $this->ftell();
235236

236237
$ZIPlocalFileHeader = $this->fread(30);
@@ -329,6 +330,7 @@ public function ZIPparseLocalFileHeader() {
329330
* @return array|false
330331
*/
331332
public function ZIPparseCentralDirectory() {
333+
$CentralDirectory = array();
332334
$CentralDirectory['offset'] = $this->ftell();
333335

334336
$ZIPcentralDirectory = $this->fread(46);
@@ -388,6 +390,7 @@ public function ZIPparseCentralDirectory() {
388390
* @return array|false
389391
*/
390392
public function ZIPparseEndOfCentralDirectory() {
393+
$EndOfCentralDirectory = array();
391394
$EndOfCentralDirectory['offset'] = $this->ftell();
392395

393396
$ZIPendOfCentralDirectory = $this->fread(22);

src/Module/Audio/Dsdiff.php

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public function Analyze() {
4949
$info['audio']['bits_per_sample'] = 1;
5050

5151
$info['dsdiff'] = array();
52+
$thisChunk = null;
5253
while (!$this->feof() && ($ChunkHeader = $this->fread(12))) {
5354
if (strlen($ChunkHeader) < 12) {
5455
$this->error('Expecting chunk header at offset '.(isset($thisChunk['offset']) ? $thisChunk['offset'] : 'N/A').', found insufficient data in file, aborting parsing');

src/Module/Audio/Flac.php

+1
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ private function parseCUESHEET($BlockData) {
401401
public function parsePICTURE() {
402402
$info = &$this->getid3->info;
403403

404+
$picture = array();
404405
$picture['typeid'] = Utils::BigEndian2Int($this->fread(4));
405406
$picture['picturetype'] = self::pictureTypeLookup($picture['typeid']);
406407
$picture['image_mime'] = $this->fread(Utils::BigEndian2Int($this->fread(4)));

src/Module/Audio/Lpac.php

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function Analyze() {
3535
$this->error('Expected "LPAC" at offset '.$info['avdataoffset'].', found "'.$StreamMarker.'"');
3636
return false;
3737
}
38+
$flags = array();
3839
$info['avdataoffset'] += 14;
3940

4041
$info['fileformat'] = 'lpac';

src/Module/Audio/Midi.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public function Analyze() {
7070
$thisfile_midi_raw['ticksperqnote'] = Utils::BigEndian2Int(substr($MIDIdata, $offset, 2));
7171
$offset += 2;
7272

73+
$trackdataarray = array();
7374
for ($i = 0; $i < $thisfile_midi_raw['tracks']; $i++) {
7475
while ((strlen($MIDIdata) - $offset) < 8) {
7576
if ($buffer = $this->fread($this->getid3->fread_buffer_size())) {
@@ -94,7 +95,7 @@ public function Analyze() {
9495
}
9596
}
9697

97-
if (!isset($trackdataarray) || !is_array($trackdataarray)) {
98+
if (!is_array($trackdataarray) || count($trackdataarray) === 0) {
9899
$this->error('Cannot find MIDI track information');
99100
unset($thisfile_midi);
100101
unset($info['fileformat']);

0 commit comments

Comments
 (0)