Make WordPress Core


Ignore:
Timestamp:
10/20/2023 01:27:56 PM (17 months ago)
Author:
SergeyBiryukov
Message:

External Libraries: Update getID3 to version 1.9.23.

The latest version includes numerous bug fixes, a few new features, as well as various improvements for PHP 8.1 and PHP 8.2 support.

This commit also includes PHPCS adjustments previously made for a passing PHP Compatibility scan.

References:

Follow-up to [47601], [48278], [52254], [54376].

Props jrf.
Fixes #59683.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ID3/module.audio.mp3.php

    r54376 r56975  
    13811381                            $Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]] = isset($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]) ? ++$Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]] : 1;
    13821382                            if (++$frames_scanned >= $max_frames_scan) {
    1383                                 $pct_data_scanned = ($this->ftell() - $info['avdataoffset']) / ($info['avdataend'] - $info['avdataoffset']);
     1383                                $pct_data_scanned = getid3_lib::SafeDiv($this->ftell() - $info['avdataoffset'], $info['avdataend'] - $info['avdataoffset']);
    13841384                                $this->warning('too many MPEG audio frames to scan, only scanned first '.$max_frames_scan.' frames ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.');
    13851385                                foreach ($Distribution as $key1 => $value1) {
    13861386                                    foreach ($value1 as $key2 => $value2) {
    1387                                         $Distribution[$key1][$key2] = round($value2 / $pct_data_scanned);
     1387                                        $Distribution[$key1][$key2] = $pct_data_scanned ? round($value2 / $pct_data_scanned) : 1;
    13881388                                    }
    13891389                                }
     
    14761476        $FirstFrameThisfileInfo = null;
    14771477        while ($SynchSeekOffset < $sync_seek_buffer_size) {
    1478             if ((($avdataoffset + $SynchSeekOffset)  < $info['avdataend']) && !feof($this->getid3->fp)) {
     1478            if ((($avdataoffset + $SynchSeekOffset)  < $info['avdataend']) && !$this->feof()) {
    14791479
    14801480                if ($SynchSeekOffset > $sync_seek_buffer_size) {
     
    14881488                    }
    14891489                    if (empty($info['mpeg'])) {
    1490                         unset($info['mpeg']);
    1491                     }
    1492                     return false;
    1493 
    1494                 } elseif (feof($this->getid3->fp)) {
    1495 
    1496                     $this->error('Could not find valid MPEG audio synch before end of file');
    1497                     if (isset($info['audio']['bitrate'])) {
    1498                         unset($info['audio']['bitrate']);
    1499                     }
    1500                     if (isset($info['mpeg']['audio'])) {
    1501                         unset($info['mpeg']['audio']);
    1502                     }
    1503                     if (isset($info['mpeg']) && (!is_array($info['mpeg']) || (count($info['mpeg']) == 0))) {
    15041490                        unset($info['mpeg']);
    15051491                    }
     
    16531639                                $frames_scanned++;
    16541640                                if ($frames_scan_per_segment && (++$frames_scanned_this_segment >= $frames_scan_per_segment)) {
    1655                                     $this_pct_scanned = ($this->ftell() - $scan_start_offset[$current_segment]) / ($info['avdataend'] - $info['avdataoffset']);
     1641                                    $this_pct_scanned = getid3_lib::SafeDiv($this->ftell() - $scan_start_offset[$current_segment], $info['avdataend'] - $info['avdataoffset']);
    16561642                                    if (($current_segment == 0) && (($this_pct_scanned * $max_scan_segments) >= 1)) {
    16571643                                        // file likely contains < $max_frames_scan, just scan as one segment
     
    17441730        }
    17451731        $info['audio']['channels']        = $info['mpeg']['audio']['channels'];
     1732        if ($info['audio']['channels'] < 1) {
     1733            $this->error('Corrupt MP3 file: no channels');
     1734            return false;
     1735        }
    17461736        $info['audio']['channelmode']     = $info['mpeg']['audio']['channelmode'];
    17471737        $info['audio']['sample_rate']     = $info['mpeg']['audio']['sample_rate'];
Note: See TracChangeset for help on using the changeset viewer.