Skip to content

Commit

Permalink
Merge pull request #346 from StudioMaX/2.0-with-fixes
Browse files Browse the repository at this point in the history
Sync 2.x with 1.9.21-202109171300
  • Loading branch information
StudioMaX authored Oct 6, 2021
2 parents 131d4ad + ae22592 commit 5ad7910
Show file tree
Hide file tree
Showing 39 changed files with 1,886 additions and 469 deletions.
11 changes: 2 additions & 9 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ jobs:
lint:
name: "Lint"
runs-on: "ubuntu-latest"
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
Expand All @@ -20,21 +19,15 @@ jobs:
- "7.3"
- "7.4"
- "8.0"
experimental:
- false
include:
- php-version: "8.1"
experimental: true
composer-options: "--ignore-platform-reqs"
- "8.1"
steps:
- uses: "actions/checkout@v2"
- uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
ini-values: error_reporting=-1, display_errors=On
coverage: "none"
- uses: "ramsey/composer-install@v1"
with:
composer-options: "${{ matrix.composer-options }}"
- name: "Run the linter"
run: "composer lint -- --colors"

Expand Down
36 changes: 36 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,42 @@
Version History
===============

1.9.21: [2021-09-22] James Heinrich :: 1.9.21-202109171300
» add support for RIFF.guan
¤ add ID3v1 genres 148-191
¤ torrent files easy access key
* bugfix #342 demo.mysqli.php XSS
* bugfix #340 default quicktime.ReturnAtomData=false
* bugfix #338 improved transliterated tag merging
* bugfix #337 PHP 8.1 compatibility
* bugfix #335 PHP 8.1 compatibility
* bugfix #330 QuicktimeContentRatingLookup 'rtng'
* bugfix #328 throw exception if a resource seek fails
* bugfix #326 improved temporary path detection
* bugfix #325 INF/NAN constants instead of float/string
* bugfix #324 Nikon-specific atoms in QuickTime
* bugfix #321 prevent errors on corrupt JPEGs
* bugfix #319 prevent error in ZIP contents MIME detect
* bugfix #315 ID3v2 USLT check for data length
* bugfix #308 silence libxml deprecation warning
* bugfix #304 undefined index: comments
* bugfix #299 decbin type error in PHP8
* bugfix #298 error scanning WAV via file pointer
* bugfix #294 replace IMG_JPG with IMAGETYPE_JPEG
* bugfix #292 PDFs take long time to parse
* bugfix #291 divzero QuickTime with no playable content
* bugfix #290 detect ID3v1 on minimal example files
* bugfix #289 avoid crash on invalid TIFF
* bugfix #287 mp3 CBR detected as VBR
* bugfix #286 corrupt mp3 can cause slow scanning
* bugfix #284 allow "0" as a value in tags
* bugfix #283 array offset on value of type int
* bugfix #277 ID3v2 add new Turkish Lira TRY
* bugfix #270 demo.mysqli.php LONGBLOB
* bugfix #266 fix possible endless loop on PNG
* bugfix #257 undefined variables
* bugfix #207 improved LAME version string parsing

1.9.20: [2020-06-30] James Heinrich :: 1.9.20-202006061653
» add support for DSDIFF audio
» add support for TAK lossess audio
Expand Down
8 changes: 4 additions & 4 deletions demos/demo.mp3header.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ function Dec2Bin($number) {
}
$bytes[] = $number;
$binstring = '';
for ($i = 0; $i < count($bytes); $i++) {
$binstring = (($i == count($bytes) - 1) ? decbin($bytes[$i]) : str_pad(decbin($bytes[$i]), 8, '0', STR_PAD_LEFT)).$binstring;
foreach ($bytes as $i => $byte) {
$binstring = (($i == count($bytes) - 1) ? decbin($byte) : str_pad(decbin($byte), 8, '0', STR_PAD_LEFT)).$binstring;
}
return $binstring;
}
Expand Down Expand Up @@ -586,8 +586,8 @@ function is_hash($var) {
if (is_array($var)) {
$keys = array_keys($var);
$all_num = true;
for ($i = 0; $i < count($keys); $i++) {
if (is_string($keys[$i])) {
foreach ($keys as $key) {
if (is_string($key)) {
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion demos/demo.mysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ function SynchronizeAllTags($filename, $synchronizefrom='all', $synchronizeto='A
} else {

echo '<a href="'.htmlentities($_SERVER['PHP_SELF'].'?encoderoptionsdistribution=1').'">Show all Encoder Options</a><hr>';
echo 'Files with Encoder Options <b>'.$_REQUEST['showtagfiles'].'</b>:<br>';
echo 'Files with Encoder Options <b>'.htmlentities($_REQUEST['showtagfiles']).'</b>:<br>';
echo '<table border="1" cellspacing="0" cellpadding="3">';
while ($row = mysqli_fetch_array($result)) {
echo '<tr>';
Expand Down
1 change: 1 addition & 0 deletions src/Cache/Dbm.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ public function clear_cache() {
*/
public function analyze($filename, $filesize=null, $original_filename='', $fp=null) {

$key = null;
if (file_exists($filename)) {

// Calc key filename::mod_time::size - should be unique
Expand Down
4 changes: 2 additions & 2 deletions src/GetID3.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class GetID3
*
* @var bool
*/
public $options_audiovideo_quicktime_ReturnAtomData = true;
public $options_audiovideo_quicktime_ReturnAtomData = false;

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

const VERSION = '2.0.x-202105131611';
const VERSION = '2.0.x-202109171300';
const FREAD_BUFFER_SIZE = 32768;

const ATTACHMENTS_NONE = false;
Expand Down
8 changes: 4 additions & 4 deletions src/Module/Archive/Gzip.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function Analyze() {
$num_members = 0;
while (true) {
$is_wrong_members = false;
$num_members = intval(count($arr_members));
$num_members = count($arr_members);
for ($i = 0; $i < $num_members; $i++) {
if (strlen($arr_members[$i]) == 0) {
continue;
Expand All @@ -84,13 +84,13 @@ public function Analyze() {

$fpointer = 0;
$idx = 0;
for ($i = 0; $i < $num_members; $i++) {
if (strlen($arr_members[$i]) == 0) {
foreach ($arr_members as $member) {
if (strlen($member) == 0) {
continue;
}
$thisInfo = &$info['gzip']['member_header'][++$idx];

$buff = "\x1F\x8B\x08".$arr_members[$i];
$buff = "\x1F\x8B\x08". $member;

$attr = unpack($unpack_header, substr($buff, 0, $start_length));
$thisInfo['filemtime'] = Utils::LittleEndian2Int($attr['mtime']);
Expand Down
3 changes: 3 additions & 0 deletions src/Module/Archive/Tar.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ public function display_perms($mode) {
else $type='u'; // UNKNOWN

// Determine permissions
$owner = array();
$group = array();
$world = array();
$owner['read'] = (($mode & 00400) ? 'r' : '-');
$owner['write'] = (($mode & 00200) ? 'w' : '-');
$owner['execute'] = (($mode & 00100) ? 'x' : '-');
Expand Down
9 changes: 6 additions & 3 deletions src/Module/Archive/Zip.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ public function Analyze() {
!empty($info['zip']['files']['docProps']['core.xml'])) {
// http://technet.microsoft.com/en-us/library/cc179224.aspx
$info['fileformat'] = 'zip.msoffice';
if (!empty($ThisFileInfo['zip']['files']['ppt'])) {
if (!empty($info['zip']['files']['ppt'])) {
$info['mime_type'] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
} elseif (!empty($ThisFileInfo['zip']['files']['xl'])) {
} elseif (!empty($info['zip']['files']['xl'])) {
$info['mime_type'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
} elseif (!empty($ThisFileInfo['zip']['files']['word'])) {
} elseif (!empty($info['zip']['files']['word'])) {
$info['mime_type'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
}
}
Expand Down Expand Up @@ -231,6 +231,7 @@ public function getZIPentriesFilepointer() {
* @return array|false
*/
public function ZIPparseLocalFileHeader() {
$LocalFileHeader = array();
$LocalFileHeader['offset'] = $this->ftell();

$ZIPlocalFileHeader = $this->fread(30);
Expand Down Expand Up @@ -329,6 +330,7 @@ public function ZIPparseLocalFileHeader() {
* @return array|false
*/
public function ZIPparseCentralDirectory() {
$CentralDirectory = array();
$CentralDirectory['offset'] = $this->ftell();

$ZIPcentralDirectory = $this->fread(46);
Expand Down Expand Up @@ -388,6 +390,7 @@ public function ZIPparseCentralDirectory() {
* @return array|false
*/
public function ZIPparseEndOfCentralDirectory() {
$EndOfCentralDirectory = array();
$EndOfCentralDirectory['offset'] = $this->ftell();

$ZIPendOfCentralDirectory = $this->fread(22);
Expand Down
1 change: 1 addition & 0 deletions src/Module/Audio/Dsdiff.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function Analyze() {
$info['audio']['bits_per_sample'] = 1;

$info['dsdiff'] = array();
$thisChunk = null;
while (!$this->feof() && ($ChunkHeader = $this->fread(12))) {
if (strlen($ChunkHeader) < 12) {
$this->error('Expecting chunk header at offset '.(isset($thisChunk['offset']) ? $thisChunk['offset'] : 'N/A').', found insufficient data in file, aborting parsing');
Expand Down
1 change: 1 addition & 0 deletions src/Module/Audio/Flac.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ private function parseCUESHEET($BlockData) {
public function parsePICTURE() {
$info = &$this->getid3->info;

$picture = array();
$picture['typeid'] = Utils::BigEndian2Int($this->fread(4));
$picture['picturetype'] = self::pictureTypeLookup($picture['typeid']);
$picture['image_mime'] = $this->fread(Utils::BigEndian2Int($this->fread(4)));
Expand Down
1 change: 1 addition & 0 deletions src/Module/Audio/Lpac.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function Analyze() {
$this->error('Expected "LPAC" at offset '.$info['avdataoffset'].', found "'.$StreamMarker.'"');
return false;
}
$flags = array();
$info['avdataoffset'] += 14;

$info['fileformat'] = 'lpac';
Expand Down
3 changes: 2 additions & 1 deletion src/Module/Audio/Midi.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function Analyze() {
$thisfile_midi_raw['ticksperqnote'] = Utils::BigEndian2Int(substr($MIDIdata, $offset, 2));
$offset += 2;

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

if (!isset($trackdataarray) || !is_array($trackdataarray)) {
if (!is_array($trackdataarray) || count($trackdataarray) === 0) {
$this->error('Cannot find MIDI track information');
unset($thisfile_midi);
unset($info['fileformat']);
Expand Down
Loading

0 comments on commit 5ad7910

Please sign in to comment.