Make WordPress Core


Ignore:
Timestamp:
09/14/2019 07:06:09 PM (7 years ago)
Author:
jorbin
Message:

Update getID3 library to fix issues with PHP7.4

Updates to trunk version that includes fixes for PHP7.4

Changelog:
​https://github.com/JamesHeinrich/getID3/compare/v1.9.14...00f3fbfd77e583099ca70a3cf0bc092e113d2b20

See: #47751,#47783.
Fixes: #48040.

File:
1 edited

Legend:

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

    r41196 r46112  
    11<?php
     2
    23/////////////////////////////////////////////////////////////////
    34/// getID3() by James Heinrich <info@getid3.org>               //
    4 //  available at http://getid3.sourceforge.net                 //
    5 //            or http://www.getid3.org                         //
    6 //          also https://github.com/JamesHeinrich/getID3       //
    7 /////////////////////////////////////////////////////////////////
    8 // See readme.txt for more details                             //
     5//  available at https://github.com/JamesHeinrich/getID3       //
     6//            or https://www.getid3.org                        //
     7//            or http://getid3.sourceforge.net                 //
     8//  see readme.txt for more details                            //
    99/////////////////////////////////////////////////////////////////
    1010//                                                             //
    … …  
    1717class getid3_apetag extends getid3_handler
    1818{
    19         public $inline_attachments = true; // true: return full data for all attachments; false: return no data for all attachments; integer: return data for attachments <= than this; string: save as file to this directory
     19        /**
     20         * true: return full data for all attachments;
     21         * false: return no data for all attachments;
     22         * integer: return data for attachments <= than this;
     23         * string: save as file to this directory.
     24         *
     25         * @var int|bool|string
     26         */
     27        public $inline_attachments = true;
     28
    2029        public $overrideendoffset  = 0;
    2130
     31        /**
     32         * @return bool
     33         */
    2234        public function Analyze() {
    2335                $info = &$this->getid3->info;
    … …  
    151163                                // http://wiki.hydrogenaud.io/index.php?title=ReplayGain#MP3Gain
    152164                                case 'replaygain_track_gain':
    153                                         if (preg_match('#^[\\-\\+][0-9\\.,]{8}$#', $thisfile_ape_items_current['data'][0])) {
    154                                                 $thisfile_replaygain['track']['adjustment'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
     165                                        if (preg_match('#^([\\-\\+][0-9\\.,]{8})( dB)?$#', $thisfile_ape_items_current['data'][0], $matches)) {
     166                                                $thisfile_replaygain['track']['adjustment'] = (float) str_replace(',', '.', $matches[1]); // float casting will see "0,95" as zero!
    155167                                                $thisfile_replaygain['track']['originator'] = 'unspecified';
    156168                                        } else {
    … …  
    160172
    161173                                case 'replaygain_track_peak':
    162                                         if (preg_match('#^[0-9\\.,]{8}$#', $thisfile_ape_items_current['data'][0])) {
    163                                                 $thisfile_replaygain['track']['peak']       = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
     174                                        if (preg_match('#^([0-9\\.,]{8})$#', $thisfile_ape_items_current['data'][0], $matches)) {
     175                                                $thisfile_replaygain['track']['peak']       = (float) str_replace(',', '.', $matches[1]); // float casting will see "0,95" as zero!
    164176                                                $thisfile_replaygain['track']['originator'] = 'unspecified';
    165177                                                if ($thisfile_replaygain['track']['peak'] <= 0) {
    … …  
    172184
    173185                                case 'replaygain_album_gain':
    174                                         if (preg_match('#^[\\-\\+][0-9\\.,]{8}$#', $thisfile_ape_items_current['data'][0])) {
    175                                                 $thisfile_replaygain['album']['adjustment'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
     186                                        if (preg_match('#^([\\-\\+][0-9\\.,]{8})( dB)?$#', $thisfile_ape_items_current['data'][0], $matches)) {
     187                                                $thisfile_replaygain['album']['adjustment'] = (float) str_replace(',', '.', $matches[1]); // float casting will see "0,95" as zero!
    176188                                                $thisfile_replaygain['album']['originator'] = 'unspecified';
    177189                                        } else {
    … …  
    181193
    182194                                case 'replaygain_album_peak':
    183                                         if (preg_match('#^[0-9\\.,]{8}$#', $thisfile_ape_items_current['data'][0])) {
    184                                                 $thisfile_replaygain['album']['peak']       = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
     195                                        if (preg_match('#^([0-9\\.,]{8})$#', $thisfile_ape_items_current['data'][0], $matches)) {
     196                                                $thisfile_replaygain['album']['peak']       = (float) str_replace(',', '.', $matches[1]); // float casting will see "0,95" as zero!
    185197                                                $thisfile_replaygain['album']['originator'] = 'unspecified';
    186198                                                if ($thisfile_replaygain['album']['peak'] <= 0) {
    … …  
    226238                                        if (is_array($thisfile_ape_items_current['data'])) {
    227239                                                foreach ($thisfile_ape_items_current['data'] as $comment) {
    228                                                         $thisfile_ape['comments']['track'][] = $comment;
     240                                                        $thisfile_ape['comments']['track_number'][] = $comment;
    229241                                                }
    230242                                        }
    … …  
    336348        }
    337349
     350        /**
     351         * @param string $APEheaderFooterData
     352         *
     353         * @return array|false
     354         */
    338355        public function parseAPEheaderFooter($APEheaderFooterData) {
    339356                // http://www.uni-jena.de/~pfk/mpp/sv8/apeheader.html
    … …  
    360377        }
    361378
     379        /**
     380         * @param int $rawflagint
     381         *
     382         * @return array
     383         */
    362384        public function parseAPEtagFlags($rawflagint) {
    363385                // "Note: APE Tags 1.0 do not use any of the APE Tag flags.
    … …  
    375397        }
    376398
     399        /**
     400         * @param int $contenttypeid
     401         *
     402         * @return string
     403         */
    377404        public function APEcontentTypeFlagLookup($contenttypeid) {
    378405                static $APEcontentTypeFlagLookup = array(
    … …  
    385412        }
    386413
     414        /**
     415         * @param string $itemkey
     416         *
     417         * @return bool
     418         */
    387419        public function APEtagItemIsUTF8Lookup($itemkey) {
    388420                static $APEtagItemIsUTF8Lookup = array(
Note: See TracChangeset for help on using the changeset viewer.