Make WordPress Core


Ignore:
Timestamp:
10/20/2023 01:27:56 PM (7 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-video.riff.php

    r54376 r56975  
    215215
    216216                    if (empty($info['playtime_seconds'])) { // may already be set (e.g. DTS-WAV)
    217                         $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $thisfile_audio['bitrate']);
     217                        $info['playtime_seconds'] =  (float)getid3_lib::SafeDiv(($info['avdataend'] - $info['avdataoffset']) * 8, $thisfile_audio['bitrate']);
    218218                    }
    219219
     
    441441                        if (isset($parsedXML['SPEED']['MASTER_SPEED'])) {
    442442                            @list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['MASTER_SPEED']);
    443                             $thisfile_riff_WAVE['iXML'][0]['master_speed'] = $numerator / ($denominator ? $denominator : 1000);
     443                            $thisfile_riff_WAVE['iXML'][0]['master_speed'] = (int) $numerator / ($denominator ? $denominator : 1000);
    444444                        }
    445445                        if (isset($parsedXML['SPEED']['TIMECODE_RATE'])) {
    446446                            @list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['TIMECODE_RATE']);
    447                             $thisfile_riff_WAVE['iXML'][0]['timecode_rate'] = $numerator / ($denominator ? $denominator : 1000);
     447                            $thisfile_riff_WAVE['iXML'][0]['timecode_rate'] = (int) $numerator / ($denominator ? $denominator : 1000);
    448448                        }
    449449                        if (isset($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO']) && !empty($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) && !empty($thisfile_riff_WAVE['iXML'][0]['timecode_rate'])) {
     
    522522                if (!isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) {
    523523                    $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate'];
    524                     $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $thisfile_audio['bitrate']);
     524                    $info['playtime_seconds'] = (float)getid3_lib::SafeDiv((($info['avdataend'] - $info['avdataoffset']) * 8), $thisfile_audio['bitrate']);
    525525                }
    526526
     
    532532                    // Reset to the way it was - RIFF parsing will have messed this up
    533533                    $info['avdataend']        = $Original['avdataend'];
    534                     $thisfile_audio['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
     534                    $thisfile_audio['bitrate'] = getid3_lib::SafeDiv(($info['avdataend'] - $info['avdataoffset']) * 8, $info['playtime_seconds']);
    535535
    536536                    $this->fseek($info['avdataoffset'] - 44);
     
    633633                }
    634634                if ($info['avdataend'] > $info['filesize']) {
    635                     switch (!empty($thisfile_audio_dataformat) ? $thisfile_audio_dataformat : '') {
     635                    switch ($thisfile_audio_dataformat) {
    636636                        case 'wavpack': // WavPack
    637637                        case 'lpac':    // LPAC
     
    673673                    }
    674674                }
    675                 if (isset($thisfile_audio_dataformat) && ($thisfile_audio_dataformat == 'ac3')) {
     675                if ($thisfile_audio_dataformat == 'ac3') {
    676676                    unset($thisfile_audio['bits_per_sample']);
    677677                    if (!empty($info['ac3']['bitrate']) && ($info['ac3']['bitrate'] != $thisfile_audio['bitrate'])) {
     
    782782                    $thisfile_riff_video_current = &$thisfile_riff_video[$streamindex];
    783783
    784                     if ($thisfile_riff_raw_avih['dwWidth'] > 0) {
     784                    if ($thisfile_riff_raw_avih['dwWidth'] > 0) { // @phpstan-ignore-line
    785785                        $thisfile_riff_video_current['frame_width'] = $thisfile_riff_raw_avih['dwWidth'];
    786786                        $thisfile_video['resolution_x']             = $thisfile_riff_video_current['frame_width'];
    787787                    }
    788                     if ($thisfile_riff_raw_avih['dwHeight'] > 0) {
     788                    if ($thisfile_riff_raw_avih['dwHeight'] > 0) { // @phpstan-ignore-line
    789789                        $thisfile_riff_video_current['frame_height'] = $thisfile_riff_raw_avih['dwHeight'];
    790790                        $thisfile_video['resolution_y']              = $thisfile_riff_video_current['frame_height'];
    791791                    }
    792                     if ($thisfile_riff_raw_avih['dwTotalFrames'] > 0) {
     792                    if ($thisfile_riff_raw_avih['dwTotalFrames'] > 0) { // @phpstan-ignore-line
    793793                        $thisfile_riff_video_current['total_frames'] = $thisfile_riff_raw_avih['dwTotalFrames'];
    794794                        $thisfile_video['total_frames']              = $thisfile_riff_video_current['total_frames'];
     
    19141914                                        unset($RIFFchunk[$chunkname][$thisindex]);
    19151915                                    }
    1916                                     if (isset($RIFFchunk[$chunkname]) && empty($RIFFchunk[$chunkname])) {
     1916                                    if (count($RIFFchunk[$chunkname]) === 0) {
    19171917                                        unset($RIFFchunk[$chunkname]);
    19181918                                    }
     
    20352035            if (isset($RIFFinfoArray[$key])) {
    20362036                foreach ($RIFFinfoArray[$key] as $commentid => $commentdata) {
    2037                     if (trim($commentdata['data']) != '') {
     2037                    if (!empty($commentdata['data']) && trim($commentdata['data']) != '') {
    20382038                        if (isset($CommentsTargetArray[$value])) {
    20392039                            $CommentsTargetArray[$value][] =     trim($commentdata['data']);
Note: See TracChangeset for help on using the changeset viewer.