Make WordPress Core


Ignore:
Timestamp:
11/24/2025 06:36:59 PM (3 months ago)
Author:
SergeyBiryukov
Message:

External Libraries: Update getID3 to version 1.9.24.

In [60812], two changes related to PHP 8.5 compatibility were cherry picked from the upstream repository to be included in time for WordPress 6.9. Since then, a proper release has been tagged which includes several bug fixes in addition to the previous two changes.

HEIF support has also been added to the Quicktime audio/video module.

A full list of changes can be found on GitHub: https://github.com/JamesHeinrich/getID3/releases/tag/v1.9.24

Reviewed by desrosj, SergeyBiryukov.
Merges [61253] to the 6.9 branch.

Props TobiasBg.
Fixes #64253.

Location:
branches/6.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.9

  • branches/6.9/src/wp-includes/ID3/getid3.lib.php

    r60812 r61289  
    1212/////////////////////////////////////////////////////////////////
    1313
    14 if(!defined('GETID3_LIBXML_OPTIONS') && defined('LIBXML_VERSION')) {
    15     if(LIBXML_VERSION >= 20621) {
     14if (!defined('GETID3_LIBXML_OPTIONS') && defined('LIBXML_VERSION')) {
     15    if (LIBXML_VERSION >= 20621) {
    1616        define('GETID3_LIBXML_OPTIONS', LIBXML_NOENT | LIBXML_NONET | LIBXML_NOWARNING | LIBXML_COMPACT);
    1717    } else {
     
    7474    /**
    7575     * @param int|null $variable
    76      * @param int      $increment
     76     * @param-out int  $variable
     77     * @param int      $increment
    7778     *
    7879     * @return bool
     
    116117        static $hasINT64 = null;
    117118        if ($hasINT64 === null) { // 10x faster than is_null()
    118             $hasINT64 = is_int(pow(2, 31)); // 32-bit int are limited to (2^31)-1
     119            /** @var int|float|object $bigInt */
     120            $bigInt = pow(2, 31);
     121            $hasINT64 = is_int($bigInt); // 32-bit int are limited to (2^31)-1
    119122            if (!$hasINT64 && !defined('PHP_INT_MIN')) {
    120123                define('PHP_INT_MIN', ~PHP_INT_MAX);
     
    441444
    442445    /**
    443      * @param int $number
     446     * @param int|string $number
    444447     *
    445448     * @return string
     
    745748     */
    746749    public static function XML2array($XMLstring) {
    747         if (function_exists('simplexml_load_string') && function_exists('libxml_disable_entity_loader')) {
    748             // http://websec.io/2012/08/27/Preventing-XEE-in-PHP.html
    749             // https://core.trac.wordpress.org/changeset/29378
    750             // This function has been deprecated in PHP 8.0 because in libxml 2.9.0, external entity loading is
    751             // disabled by default, but is still needed when LIBXML_NOENT is used.
    752             $loader = @libxml_disable_entity_loader(true);
    753             $XMLobject = simplexml_load_string($XMLstring, 'SimpleXMLElement', GETID3_LIBXML_OPTIONS);
    754             $return = self::SimpleXMLelement2array($XMLobject);
    755             @libxml_disable_entity_loader($loader);
    756             return $return;
     750        if (function_exists('simplexml_load_string')) {
     751            if (PHP_VERSION_ID < 80000) {
     752                if (function_exists('libxml_disable_entity_loader')) {
     753                    // http://websec.io/2012/08/27/Preventing-XEE-in-PHP.html
     754                    // https://core.trac.wordpress.org/changeset/29378
     755                    // This function has been deprecated in PHP 8.0 because in libxml 2.9.0, external entity loading is
     756                    // disabled by default, but is still needed when LIBXML_NOENT is used.
     757                    $loader = @libxml_disable_entity_loader(true);
     758                    $XMLobject = simplexml_load_string($XMLstring, 'SimpleXMLElement', GETID3_LIBXML_OPTIONS);
     759                    $return = self::SimpleXMLelement2array($XMLobject);
     760                    @libxml_disable_entity_loader($loader);
     761                    return $return;
     762                }
     763            } else {
     764                $allow = false;
     765                if (defined('LIBXML_VERSION') && (LIBXML_VERSION >= 20900)) {
     766                    // https://www.php.net/manual/en/function.libxml-disable-entity-loader.php
     767                    // "as of libxml 2.9.0 entity substitution is disabled by default, so there is no need to disable the loading
     768                    //  of external entities, unless there is the need to resolve internal entity references with LIBXML_NOENT."
     769                    $allow = true;
     770                } elseif (function_exists('libxml_set_external_entity_loader')) {
     771                    libxml_set_external_entity_loader(function () { return null; }); // https://www.zend.com/blog/cve-2023-3823
     772                    $allow = true;
     773                }
     774                if ($allow) {
     775                    $XMLobject = simplexml_load_string($XMLstring, 'SimpleXMLElement', GETID3_LIBXML_OPTIONS);
     776                    $return = self::SimpleXMLelement2array($XMLobject);
     777                    return $return;
     778                }
     779            }
    757780        }
    758781        return false;
     
    14981521        if (PHP_VERSION_ID >= 50400) {
    14991522            $GetDataImageSize = @getimagesizefromstring($imgData, $imageinfo);
    1500             if ($GetDataImageSize === false || !isset($GetDataImageSize[0], $GetDataImageSize[1])) {
     1523            if ($GetDataImageSize === false) {
    15011524                return false;
    15021525            }
     
    15261549                fclose($tmp);
    15271550                $GetDataImageSize = @getimagesize($tempfilename, $imageinfo);
    1528                 if (($GetDataImageSize === false) || !isset($GetDataImageSize[0]) || !isset($GetDataImageSize[1])) {
     1551                if ($GetDataImageSize === false) {
    15291552                    return false;
    15301553                }
     
    17201743            //$cache[$file][$name][substr($line, 0, $keylength)] = trim(substr($line, $keylength + 1));
    17211744            $explodedLine = explode("\t", $line, 2);
    1722             $ThisKey   = (isset($explodedLine[0]) ? $explodedLine[0] : '');
     1745            $ThisKey   = $explodedLine[0];
    17231746            $ThisValue = (isset($explodedLine[1]) ? $explodedLine[1] : '');
    17241747            $cache[$file][$name][$ThisKey] = trim($ThisValue);
Note: See TracChangeset for help on using the changeset viewer.