Make WordPress Core

Changeset 50714


Ignore:
Timestamp:
04/14/2021 11:08:25 PM (5 years ago)
Author:
desrosj
Message:

External libraries: Include upstream GetID3 fix for PHP 8.

Props jrf, xknown.

File:
1 edited

Legend:

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

    r49621 r50714  
    721721        public static function XML2array($XMLstring) {
    722722                if (function_exists('simplexml_load_string') && function_exists('libxml_disable_entity_loader')) {
    723                         if (PHP_VERSION_ID < 80000) {
    724                                 // http://websec.io/2012/08/27/Preventing-XEE-in-PHP.html
    725                                 // https://core.trac.wordpress.org/changeset/29378
    726                                 // This function has been deprecated in PHP 8.0 because in libxml 2.9.0, external entity loading is
    727                                 // disabled by default, so this function is no longer needed to protect against XXE attacks.
    728                                 $loader = libxml_disable_entity_loader(true);
    729                         }
     723                        // http://websec.io/2012/08/27/Preventing-XEE-in-PHP.html
     724                        // https://core.trac.wordpress.org/changeset/29378
     725                        // This function has been deprecated in PHP 8.0 because in libxml 2.9.0, external entity loading is
     726                        // disabled by default, but is still needed when LIBXML_NOENT is used.
     727                        $loader = @libxml_disable_entity_loader(true);
    730728                        $XMLobject = simplexml_load_string($XMLstring, 'SimpleXMLElement', LIBXML_NOENT);
    731729                        $return = self::SimpleXMLelement2array($XMLobject);
    732                         if (PHP_VERSION_ID < 80000 && isset($loader)) {
    733                                 libxml_disable_entity_loader($loader);
    734                         }
     730                        @libxml_disable_entity_loader($loader);
    735731                        return $return;
    736732                }
Note: See TracChangeset for help on using the changeset viewer.