Changeset 61289 for branches/6.9/src/wp-includes/ID3/getid3.lib.php
- Timestamp:
- 11/24/2025 06:36:59 PM (3 months ago)
- Location:
- branches/6.9
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/wp-includes/ID3/getid3.lib.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/6.9
-
branches/6.9/src/wp-includes/ID3/getid3.lib.php
r60812 r61289 12 12 ///////////////////////////////////////////////////////////////// 13 13 14 if (!defined('GETID3_LIBXML_OPTIONS') && defined('LIBXML_VERSION')) {15 if (LIBXML_VERSION >= 20621) {14 if (!defined('GETID3_LIBXML_OPTIONS') && defined('LIBXML_VERSION')) { 15 if (LIBXML_VERSION >= 20621) { 16 16 define('GETID3_LIBXML_OPTIONS', LIBXML_NOENT | LIBXML_NONET | LIBXML_NOWARNING | LIBXML_COMPACT); 17 17 } else { … … 74 74 /** 75 75 * @param int|null $variable 76 * @param int $increment 76 * @param-out int $variable 77 * @param int $increment 77 78 * 78 79 * @return bool … … 116 117 static $hasINT64 = null; 117 118 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 119 122 if (!$hasINT64 && !defined('PHP_INT_MIN')) { 120 123 define('PHP_INT_MIN', ~PHP_INT_MAX); … … 441 444 442 445 /** 443 * @param int $number446 * @param int|string $number 444 447 * 445 448 * @return string … … 745 748 */ 746 749 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 } 757 780 } 758 781 return false; … … 1498 1521 if (PHP_VERSION_ID >= 50400) { 1499 1522 $GetDataImageSize = @getimagesizefromstring($imgData, $imageinfo); 1500 if ($GetDataImageSize === false || !isset($GetDataImageSize[0], $GetDataImageSize[1])) {1523 if ($GetDataImageSize === false) { 1501 1524 return false; 1502 1525 } … … 1526 1549 fclose($tmp); 1527 1550 $GetDataImageSize = @getimagesize($tempfilename, $imageinfo); 1528 if ( ($GetDataImageSize === false) || !isset($GetDataImageSize[0]) || !isset($GetDataImageSize[1])) {1551 if ($GetDataImageSize === false) { 1529 1552 return false; 1530 1553 } … … 1720 1743 //$cache[$file][$name][substr($line, 0, $keylength)] = trim(substr($line, $keylength + 1)); 1721 1744 $explodedLine = explode("\t", $line, 2); 1722 $ThisKey = (isset($explodedLine[0]) ? $explodedLine[0] : '');1745 $ThisKey = $explodedLine[0]; 1723 1746 $ThisValue = (isset($explodedLine[1]) ? $explodedLine[1] : ''); 1724 1747 $cache[$file][$name][$ThisKey] = trim($ThisValue);
Note: See TracChangeset
for help on using the changeset viewer.