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.audio-video.asf.php

    r41196 r46112  
    22/////////////////////////////////////////////////////////////////
    33/// 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                             //
     4//  available at https://github.com/JamesHeinrich/getID3       //
     5//            or https://www.getid3.org                        //
     6//            or http://getid3.sourceforge.net                 //
     7//  see readme.txt for more details                            //
    98/////////////////////////////////////////////////////////////////
    109//                                                             //
    … …  
    1716getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
    1817
    19 class getid3_asf extends getid3_handler {
    20 
     18class getid3_asf extends getid3_handler
     19{
     20        /**
     21         * @param getID3 $getid3
     22         */
    2123        public function __construct(getID3 $getid3) {
    2224                parent::__construct($getid3);  // extends getid3_handler::__construct()
    … …  
    3133        }
    3234
     35        /**
     36         * @return bool
     37         */
    3338        public function Analyze() {
    3439                $info = &$this->getid3->info;
    … …  
    8489                $ASFHeaderData = $this->fread($thisfile_asf_headerobject['objectsize'] - 30);
    8590                $offset = 0;
     91                $thisfile_asf_streambitratepropertiesobject = array();
     92                $thisfile_asf_codeclistobject = array();
    8693
    8794                for ($HeaderObjectsCounter = 0; $HeaderObjectsCounter < $thisfile_asf_headerobject['headerobjects']; $HeaderObjectsCounter++) {
    … …  
    791798                                                        case 'tracknumber':
    792799                                                                // be careful casting to int: casting unicode strings to int gives unexpected results (stops parsing at first non-numeric character)
    793                                                                 $thisfile_asf_comments['track'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
    794                                                                 foreach ($thisfile_asf_comments['track'] as $key => $value) {
     800                                                                $thisfile_asf_comments['track_number'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
     801                                                                foreach ($thisfile_asf_comments['track_number'] as $key => $value) {
    795802                                                                        if (preg_match('/^[0-9\x00]+$/', $value)) {
    796                                                                                 $thisfile_asf_comments['track'][$key] = intval(str_replace("\x00", '', $value));
     803                                                                                $thisfile_asf_comments['track_number'][$key] = intval(str_replace("\x00", '', $value));
    797804                                                                        }
    798805                                                                }
    … …  
    800807
    801808                                                        case 'wm/track':
    802                                                                 if (empty($thisfile_asf_comments['track'])) {
    803                                                                         $thisfile_asf_comments['track'] = array(1 + $this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
     809                                                                if (empty($thisfile_asf_comments['track_number'])) {
     810                                                                        $thisfile_asf_comments['track_number'] = array(1 + $this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
    804811                                                                }
    805812                                                                break;
    … …  
    971978                        }
    972979                }
    973                 if (isset($thisfile_asf_streambitrateproperties['bitrate_records_count'])) {
     980                if (isset($thisfile_asf_streambitratepropertiesobject['bitrate_records_count'])) {
    974981                        $ASFbitrateAudio = 0;
    975982                        $ASFbitrateVideo = 0;
    976                         for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitrateproperties['bitrate_records_count']; $BitrateRecordsCounter++) {
     983                        for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitratepropertiesobject['bitrate_records_count']; $BitrateRecordsCounter++) {
    977984                                if (isset($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter])) {
    978985                                        switch ($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter]['type_raw']) {
    979986                                                case 1:
    980                                                         $ASFbitrateVideo += $thisfile_asf_streambitrateproperties['bitrate_records'][$BitrateRecordsCounter]['bitrate'];
     987                                                        $ASFbitrateVideo += $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['bitrate'];
    981988                                                        break;
    982989
    983990                                                case 2:
    984                                                         $ASFbitrateAudio += $thisfile_asf_streambitrateproperties['bitrate_records'][$BitrateRecordsCounter]['bitrate'];
     991                                                        $ASFbitrateAudio += $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['bitrate'];
    985992                                                        break;
    986993
    … …  
    14411448        }
    14421449
     1450        /**
     1451         * @param int $CodecListType
     1452         *
     1453         * @return string
     1454         */
    14431455        public static function codecListObjectTypeLookup($CodecListType) {
    14441456                static $lookup = array(
    … …  
    14511463        }
    14521464
     1465        /**
     1466         * @return array
     1467         */
    14531468        public static function KnownGUIDs() {
    14541469                static $GUIDarray = array(
    … …  
    15651580        }
    15661581
     1582        /**
     1583         * @param string $GUIDstring
     1584         *
     1585         * @return string|false
     1586         */
    15671587        public static function GUIDname($GUIDstring) {
    15681588                static $GUIDarray = array();
    … …  
    15731593        }
    15741594
     1595        /**
     1596         * @param int $id
     1597         *
     1598         * @return string
     1599         */
    15751600        public static function ASFIndexObjectIndexTypeLookup($id) {
    15761601                static $ASFIndexObjectIndexTypeLookup = array();
    … …  
    15831608        }
    15841609
     1610        /**
     1611         * @param string $GUIDstring
     1612         *
     1613         * @return string
     1614         */
    15851615        public static function GUIDtoBytestring($GUIDstring) {
    15861616                // Microsoft defines these 16-byte (128-bit) GUIDs in the strangest way:
    … …  
    16181648        }
    16191649
     1650        /**
     1651         * @param string $Bytestring
     1652         *
     1653         * @return string
     1654         */
    16201655        public static function BytestringToGUID($Bytestring) {
    1621                 $GUIDstring  = str_pad(dechex(ord($Bytestring{3})),  2, '0', STR_PAD_LEFT);
    1622                 $GUIDstring .= str_pad(dechex(ord($Bytestring{2})),  2, '0', STR_PAD_LEFT);
    1623                 $GUIDstring .= str_pad(dechex(ord($Bytestring{1})),  2, '0', STR_PAD_LEFT);
    1624                 $GUIDstring .= str_pad(dechex(ord($Bytestring{0})),  2, '0', STR_PAD_LEFT);
     1656                $GUIDstring  = str_pad(dechex(ord($Bytestring[3])),  2, '0', STR_PAD_LEFT);
     1657                $GUIDstring .= str_pad(dechex(ord($Bytestring[2])),  2, '0', STR_PAD_LEFT);
     1658                $GUIDstring .= str_pad(dechex(ord($Bytestring[1])),  2, '0', STR_PAD_LEFT);
     1659                $GUIDstring .= str_pad(dechex(ord($Bytestring[0])),  2, '0', STR_PAD_LEFT);
    16251660                $GUIDstring .= '-';
    1626                 $GUIDstring .= str_pad(dechex(ord($Bytestring{5})),  2, '0', STR_PAD_LEFT);
    1627                 $GUIDstring .= str_pad(dechex(ord($Bytestring{4})),  2, '0', STR_PAD_LEFT);
     1661                $GUIDstring .= str_pad(dechex(ord($Bytestring[5])),  2, '0', STR_PAD_LEFT);
     1662                $GUIDstring .= str_pad(dechex(ord($Bytestring[4])),  2, '0', STR_PAD_LEFT);
    16281663                $GUIDstring .= '-';
    1629                 $GUIDstring .= str_pad(dechex(ord($Bytestring{7})),  2, '0', STR_PAD_LEFT);
    1630                 $GUIDstring .= str_pad(dechex(ord($Bytestring{6})),  2, '0', STR_PAD_LEFT);
     1664                $GUIDstring .= str_pad(dechex(ord($Bytestring[7])),  2, '0', STR_PAD_LEFT);
     1665                $GUIDstring .= str_pad(dechex(ord($Bytestring[6])),  2, '0', STR_PAD_LEFT);
    16311666                $GUIDstring .= '-';
    1632                 $GUIDstring .= str_pad(dechex(ord($Bytestring{8})),  2, '0', STR_PAD_LEFT);
    1633                 $GUIDstring .= str_pad(dechex(ord($Bytestring{9})),  2, '0', STR_PAD_LEFT);
     1667                $GUIDstring .= str_pad(dechex(ord($Bytestring[8])),  2, '0', STR_PAD_LEFT);
     1668                $GUIDstring .= str_pad(dechex(ord($Bytestring[9])),  2, '0', STR_PAD_LEFT);
    16341669                $GUIDstring .= '-';
    1635                 $GUIDstring .= str_pad(dechex(ord($Bytestring{10})), 2, '0', STR_PAD_LEFT);
    1636                 $GUIDstring .= str_pad(dechex(ord($Bytestring{11})), 2, '0', STR_PAD_LEFT);
    1637                 $GUIDstring .= str_pad(dechex(ord($Bytestring{12})), 2, '0', STR_PAD_LEFT);
    1638                 $GUIDstring .= str_pad(dechex(ord($Bytestring{13})), 2, '0', STR_PAD_LEFT);
    1639                 $GUIDstring .= str_pad(dechex(ord($Bytestring{14})), 2, '0', STR_PAD_LEFT);
    1640                 $GUIDstring .= str_pad(dechex(ord($Bytestring{15})), 2, '0', STR_PAD_LEFT);
     1670                $GUIDstring .= str_pad(dechex(ord($Bytestring[10])), 2, '0', STR_PAD_LEFT);
     1671                $GUIDstring .= str_pad(dechex(ord($Bytestring[11])), 2, '0', STR_PAD_LEFT);
     1672                $GUIDstring .= str_pad(dechex(ord($Bytestring[12])), 2, '0', STR_PAD_LEFT);
     1673                $GUIDstring .= str_pad(dechex(ord($Bytestring[13])), 2, '0', STR_PAD_LEFT);
     1674                $GUIDstring .= str_pad(dechex(ord($Bytestring[14])), 2, '0', STR_PAD_LEFT);
     1675                $GUIDstring .= str_pad(dechex(ord($Bytestring[15])), 2, '0', STR_PAD_LEFT);
    16411676
    16421677                return strtoupper($GUIDstring);
    16431678        }
    16441679
     1680        /**
     1681         * @param int  $FILETIME
     1682         * @param bool $round
     1683         *
     1684         * @return float|int
     1685         */
    16451686        public static function FILETIMEtoUNIXtime($FILETIME, $round=true) {
    16461687                // FILETIME is a 64-bit unsigned integer representing
    … …  
    16541695        }
    16551696
     1697        /**
     1698         * @param int $WMpictureType
     1699         *
     1700         * @return string
     1701         */
    16561702        public static function WMpictureTypeLookup($WMpictureType) {
    16571703                static $lookup = null;
    … …  
    16851731        }
    16861732
     1733        /**
     1734         * @param string $asf_header_extension_object_data
     1735         * @param int    $unhandled_sections
     1736         *
     1737         * @return array
     1738         */
    16871739        public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) {
    16881740                // http://msdn.microsoft.com/en-us/library/bb643323.aspx
    … …  
    19311983        }
    19321984
    1933 
     1985        /**
     1986         * @param int $id
     1987         *
     1988         * @return string
     1989         */
    19341990        public static function metadataLibraryObjectDataTypeLookup($id) {
    19351991                static $lookup = array(
    … …  
    19452001        }
    19462002
     2003        /**
     2004         * @param string $data
     2005         *
     2006         * @return array
     2007         */
    19472008        public function ASF_WMpicture(&$data) {
    19482009                //typedef struct _WMPicture{
    … …  
    19952056        }
    19962057
    1997 
    1998         // Remove terminator 00 00 and convert UTF-16LE to Latin-1
     2058        /**
     2059         * Remove terminator 00 00 and convert UTF-16LE to Latin-1.
     2060         *
     2061         * @param string $string
     2062         *
     2063         * @return string
     2064         */
    19992065        public static function TrimConvert($string) {
    20002066                return trim(getid3_lib::iconv_fallback('UTF-16LE', 'ISO-8859-1', self::TrimTerm($string)), ' ');
    20012067        }
    20022068
    2003 
    2004         // Remove terminator 00 00
     2069        /**
     2070         * Remove terminator 00 00.
     2071         *
     2072         * @param string $string
     2073         *
     2074         * @return string
     2075         */
    20052076        public static function TrimTerm($string) {
    20062077                // remove terminator, only if present (it should be, but...)
Note: See TracChangeset for help on using the changeset viewer.