Make WordPress Core


Ignore:
Timestamp:
11/26/2021 03:04:10 AM (3 years ago)
Author:
SergeyBiryukov
Message:

External Libraries: Update getID3 to version 1.9.21.

The latest version includes preliminary PHP 8.1 support, as well as a variety of bug fixes.

Release notes: https://github.com/JamesHeinrich/getID3/releases/tag/v1.9.21

A full list of changes in this update can be found on GitHub:
https://github.com/JamesHeinrich/getID3/compare/v1.9.20...v1.9.21

This commit also includes:

  • Setting the $options_audiovideo_quicktime_ReturnAtomData property (now false by default) to true in wp_read_video_metadata() and wp_read_audio_metadata() in order to get the created_timestamp value.
  • PHPCS adjustments previously made for a passing PHP Compatibility scan.

Follow-up to [47601], [47737], [47902], [48278], [49621], [50714].

Props jrf, SergeyBiryukov.
Fixes #54162.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ID3/module.tag.id3v2.php

    r51901 r52254  
    346346                if (($frame_size <= strlen($framedata)) && ($this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion))) {
    347347
    348                     unset($parsedFrame);
     348                    $parsedFrame                    = array();
    349349                    $parsedFrame['frame_name']      = $frame_name;
    350350                    $parsedFrame['frame_flags_raw'] = $frame_flags;
     
    979979
    980980        } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'USLT')) || // 4.8   USLT Unsynchronised lyric/text transcription
    981                 (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ULT'))) {     // 4.9   ULT  Unsynchronised lyric/text transcription
     981                (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ULT'))) {    // 4.9   ULT  Unsynchronised lyric/text transcription
    982982            //   There may be more than one 'Unsynchronised lyrics/text transcription' frame
    983983            //   in each tag, but only one with the same language and content descriptor.
     
    995995                $frame_textencoding_terminator = "\x00";
    996996            }
    997             $frame_language = substr($parsedFrame['data'], $frame_offset, 3);
    998             $frame_offset += 3;
    999             $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset);
    1000             if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) {
    1001                 $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
    1002             }
    1003             $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
    1004             $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']);
    1005             $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator));
    1006             $parsedFrame['data'] = $this->RemoveStringTerminator($parsedFrame['data'], $frame_textencoding_terminator);
    1007 
    1008             $parsedFrame['encodingid']   = $frame_textencoding;
    1009             $parsedFrame['encoding']     = $this->TextEncodingNameLookup($frame_textencoding);
    1010 
    1011             $parsedFrame['language']     = $frame_language;
    1012             $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false);
    1013             if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
    1014                 $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
     997            if (strlen($parsedFrame['data']) >= (4 + strlen($frame_textencoding_terminator))) {  // shouldn't be an issue but badly-written files have been spotted in the wild with not only no contents but also missing the required language field, see https://github.com/JamesHeinrich/getID3/issues/315
     998                $frame_language = substr($parsedFrame['data'], $frame_offset, 3);
     999                $frame_offset += 3;
     1000                $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset);
     1001                if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) {
     1002                    $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
     1003                }
     1004                $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
     1005                $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']);
     1006                $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator));
     1007                $parsedFrame['data'] = $this->RemoveStringTerminator($parsedFrame['data'], $frame_textencoding_terminator);
     1008
     1009                $parsedFrame['encodingid']   = $frame_textencoding;
     1010                $parsedFrame['encoding']     = $this->TextEncodingNameLookup($frame_textencoding);
     1011
     1012                $parsedFrame['language']     = $frame_language;
     1013                $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false);
     1014                if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
     1015                    $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
     1016                }
     1017            } else {
     1018                $this->warning('Invalid data in frame "'.$parsedFrame['frame_name'].'" at offset '.$parsedFrame['dataoffset']);
    10151019            }
    10161020            unset($parsedFrame['data']);
     
    13711375            }
    13721376
     1377            $frame_imagetype = null;
     1378            $frame_mimetype = null;
    13731379            if ($id3v2_majorversion == 2 && strlen($parsedFrame['data']) > $frame_offset) {
    13741380                $frame_imagetype = substr($parsedFrame['data'], $frame_offset, 3);
     
    19571963            $parsedFrame['peakamplitude'] = getid3_lib::BigEndian2Float(substr($parsedFrame['data'], $frame_offset, 4));
    19581964            $frame_offset += 4;
    1959             $rg_track_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2));
    1960             $frame_offset += 2;
    1961             $rg_album_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2));
    1962             $frame_offset += 2;
    1963             $parsedFrame['raw']['track']['name']       = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 0, 3));
    1964             $parsedFrame['raw']['track']['originator'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 3, 3));
    1965             $parsedFrame['raw']['track']['signbit']    = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 6, 1));
    1966             $parsedFrame['raw']['track']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 7, 9));
    1967             $parsedFrame['raw']['album']['name']       = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 0, 3));
    1968             $parsedFrame['raw']['album']['originator'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 3, 3));
    1969             $parsedFrame['raw']['album']['signbit']    = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 6, 1));
    1970             $parsedFrame['raw']['album']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 7, 9));
     1965            foreach (array('track','album') as $rgad_entry_type) {
     1966                $rg_adjustment_word = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
     1967                $frame_offset += 2;
     1968                $parsedFrame['raw'][$rgad_entry_type]['name']       = ($rg_adjustment_word & 0xE000) >> 13;
     1969                $parsedFrame['raw'][$rgad_entry_type]['originator'] = ($rg_adjustment_word & 0x1C00) >> 10;
     1970                $parsedFrame['raw'][$rgad_entry_type]['signbit']    = ($rg_adjustment_word & 0x0200) >>  9;
     1971                $parsedFrame['raw'][$rgad_entry_type]['adjustment'] = ($rg_adjustment_word & 0x0100);
     1972            }
    19711973            $parsedFrame['track']['name']       = getid3_lib::RGADnameLookup($parsedFrame['raw']['track']['name']);
    19721974            $parsedFrame['track']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['track']['originator']);
     
    24452447            TND Dinars
    24462448            TOP Pa'anga
    2447             TRL Liras
     2449            TRL Liras (old)
     2450            TRY Liras
    24482451            TTD Dollars
    24492452            TVD Tuvalu Dollars
     
    26462649            TOP Tonga
    26472650            TRL Turkey
     2651            TRY Turkey
    26482652            TTD Trinidad and Tobago
    26492653            TVD Tuvalu
Note: See TracChangeset for help on using the changeset viewer.