Make WordPress Core


Ignore:
Timestamp:
07/02/2020 03:46:17 PM (5 years ago)
Author:
desrosj
Message:

External Libraries: Update getID3 to version 1.9.20.

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

Props hareesh-pillai, desrosj.
Previously [47601-47604].
Fixes #49945.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ID3/getid3.php

    r47737 r48278  
    100100    public $encoding_id3v1  = 'ISO-8859-1';
    101101
     102    /**
     103     * ID3v1 should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'Windows-1251' or 'KOI8-R'. If true attempt to detect these encodings, but may return incorrect values for some tags actually in ISO-8859-1 encoding
     104     *
     105     * @var bool
     106     */
     107    public $encoding_id3v1_autodetect  = false;
     108
    102109    /*
    103110     * Optional tag checks - disable for speed.
     
    251258    protected $startup_warning = '';
    252259
    253     const VERSION           = '1.9.19-201912211559';
     260    const VERSION           = '1.9.20-202006061653';
    254261    const FREAD_BUFFER_SIZE = 32768;
    255262
     
    290297        }
    291298
    292         if (($mbstring_func_overload = (int) ini_get('mbstring.func_overload')) && ($mbstring_func_overload & 0x02)) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
     299        // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
     300        if (($mbstring_func_overload = (int) ini_get('mbstring.func_overload')) && ($mbstring_func_overload & 0x02)) {
    293301            // http://php.net/manual/en/mbstring.overload.php
    294302            // "mbstring.func_overload in php.ini is a positive value that represents a combination of bitmasks specifying the categories of functions to be overloaded. It should be set to 1 to overload the mail() function. 2 for string functions, 4 for regular expression functions"
    295303            // getID3 cannot run when string functions are overloaded. It doesn't matter if mail() or ereg* functions are overloaded since getID3 does not use those.
    296             $this->startup_error .= 'WARNING: php.ini contains "mbstring.func_overload = '.ini_get('mbstring.func_overload').'", getID3 cannot run with this setting (bitmask 2 (string functions) cannot be set). Recommended to disable entirely.'."\n"; // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
     304            // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
     305            $this->startup_error .= 'WARNING: php.ini contains "mbstring.func_overload = '.ini_get('mbstring.func_overload').'", getID3 cannot run with this setting (bitmask 2 (string functions) cannot be set). Recommended to disable entirely.'."\n";
    297306        }
    298307
     
    301310            // Check for magic_quotes_runtime
    302311            if (function_exists('get_magic_quotes_runtime')) {
    303                 if (get_magic_quotes_runtime()) { // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_runtimeDeprecated
     312                // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_runtimeDeprecated
     313                if (get_magic_quotes_runtime()) {
    304314                    $this->startup_error .= 'magic_quotes_runtime must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_runtime(0) and set_magic_quotes_runtime(1).'."\n";
    305315                }
     
    307317            // Check for magic_quotes_gpc
    308318            if (function_exists('get_magic_quotes_gpc')) {
    309                 if (get_magic_quotes_gpc()) { // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_gpcDeprecated
     319                // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_gpcDeprecated
     320                if (get_magic_quotes_gpc()) {
    310321                    $this->startup_error .= 'magic_quotes_gpc must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_gpc(0) and set_magic_quotes_gpc(1).'."\n";
    311322                }
     
    847858                        ),
    848859
     860                // DSDIFF - audio     - Direct Stream Digital Interchange File Format
     861                'dsdiff' => array(
     862                            'pattern'   => '^FRM8',
     863                            'group'     => 'audio',
     864                            'module'    => 'dsdiff',
     865                            'mime_type' => 'audio/dsd',
     866                        ),
     867
    849868                // DTS  - audio       - Dolby Theatre System
    850869                'dts'  => array(
     
    974993                        ),
    975994
     995                // TAK  - audio       - Tom's lossless Audio Kompressor
     996                'tak'  => array(
     997                            'pattern'   => '^tBaK',
     998                            'group'     => 'audio',
     999                            'module'    => 'tak',
     1000                            'mime_type' => 'application/octet-stream',
     1001                        ),
     1002
    9761003                // TTA  - audio       - TTA Lossless Audio Compressor (http://tta.corecodec.org)
    9771004                'tta'  => array(
     
    10321059                            'module'    => 'flv',
    10331060                            'mime_type' => 'video/x-flv',
     1061                        ),
     1062
     1063                // IVF - audio/video - IVF
     1064                'ivf' => array(
     1065                            'pattern'   => '^DKIF',
     1066                            'group'     => 'audio-video',
     1067                            'module'    => 'ivf',
     1068                            'mime_type' => 'video/x-ivf',
    10341069                        ),
    10351070
     
    12181253                        ),
    12191254
     1255                // HPK  - data        - HPK compressed data
     1256                'hpk'  => array(
     1257                            'pattern'   => '^BPUL',
     1258                            'group'     => 'archive',
     1259                            'module'    => 'hpk',
     1260                            'mime_type' => 'application/octet-stream',
     1261                            'fail_id3'  => 'ERROR',
     1262                            'fail_ape'  => 'ERROR',
     1263                        ),
     1264
    12201265                // RAR  - data        - RAR compressed data
    12211266                'rar'  => array(
     
    12231268                            'group'     => 'archive',
    12241269                            'module'    => 'rar',
    1225                             'mime_type' => 'application/octet-stream',
     1270                            'mime_type' => 'application/vnd.rar',
    12261271                            'fail_id3'  => 'ERROR',
    12271272                            'fail_ape'  => 'ERROR',
     
    14251470                'divxtag'   => array('divx'          , 'ISO-8859-1'),
    14261471                'iptc'      => array('iptc'          , 'ISO-8859-1'),
     1472                'dsdiff'    => array('dsdiff'        , 'ISO-8859-1'),
    14271473            );
    14281474        }
     
    15271573
    15281574    /**
     1575     * Calls getid3_lib::CopyTagsToComments() but passes in the option_tags_html setting from this instance of getID3
     1576     *
     1577     * @param array $ThisFileInfo
     1578     *
     1579     * @return bool
     1580     */
     1581    public function CopyTagsToComments(&$ThisFileInfo) {
     1582        return getid3_lib::CopyTagsToComments($ThisFileInfo, $this->option_tags_html);
     1583    }
     1584
     1585    /**
    15291586     * @param string $algorithm
    15301587     *
     
    15611618            // currently vorbiscomment only works on OggVorbis files.
    15621619
    1563             if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved
     1620            // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved
     1621            if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
    15641622
    15651623                $this->warning('Failed making system call to vorbiscomment.exe - '.$algorithm.'_data is incorrect - error returned: PHP running in Safe Mode (backtick operator not available)');
     
    20552113
    20562114    /**
     2115     * @return string|false
     2116     *
     2117     * @throws getid3_exception
     2118     */
     2119    protected function fgets() {
     2120        // must be able to handle CR/LF/CRLF but not read more than one lineend
     2121        $buffer   = ''; // final string we will return
     2122        $prevchar = ''; // save previously-read character for end-of-line checking
     2123        if ($this->data_string_flag) {
     2124            while (true) {
     2125                $thischar = substr($this->data_string, $this->data_string_position++, 1);
     2126                if (($prevchar == "\r") && ($thischar != "\n")) {
     2127                    // read one byte too many, back up
     2128                    $this->data_string_position--;
     2129                    break;
     2130                }
     2131                $buffer .= $thischar;
     2132                if ($thischar == "\n") {
     2133                    break;
     2134                }
     2135                if ($this->data_string_position >= $this->data_string_length) {
     2136                    // EOF
     2137                    break;
     2138                }
     2139                $prevchar = $thischar;
     2140            }
     2141
     2142        } else {
     2143
     2144            // Ideally we would just use PHP's fgets() function, however...
     2145            // it does not behave consistently with regards to mixed line endings, may be system-dependent
     2146            // and breaks entirely when given a file with mixed \r vs \n vs \r\n line endings (e.g. some PDFs)
     2147            //return fgets($this->getid3->fp);
     2148            while (true) {
     2149                $thischar = fgetc($this->getid3->fp);
     2150                if (($prevchar == "\r") && ($thischar != "\n")) {
     2151                    // read one byte too many, back up
     2152                    fseek($this->getid3->fp, -1, SEEK_CUR);
     2153                    break;
     2154                }
     2155                $buffer .= $thischar;
     2156                if ($thischar == "\n") {
     2157                    break;
     2158                }
     2159                if (feof($this->getid3->fp)) {
     2160                    break;
     2161                }
     2162                $prevchar = $thischar;
     2163            }
     2164
     2165        }
     2166        return $buffer;
     2167    }
     2168
     2169    /**
    20572170     * @return bool
    20582171     */
Note: See TracChangeset for help on using the changeset viewer.