Changeset 60565
- Timestamp:
- 11/17/2025 10:22:33 PM (7 days ago)
- Location:
- trunk/wp-includes
- Files:
-
- 11 edited
-
ID3/getid3.lib.php (modified) (8 diffs)
-
ID3/getid3.php (modified) (8 diffs)
-
ID3/module.audio-video.asf.php (modified) (15 diffs)
-
ID3/module.audio-video.quicktime.php (modified) (14 diffs)
-
ID3/module.audio-video.riff.php (modified) (12 diffs)
-
ID3/module.audio.mp3.php (modified) (7 diffs)
-
ID3/module.audio.ogg.php (modified) (1 diff)
-
ID3/module.tag.apetag.php (modified) (1 diff)
-
ID3/module.tag.id3v2.php (modified) (3 diffs)
-
ID3/module.tag.lyrics3.php (modified) (5 diffs)
-
version.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/ID3/getid3.lib.php
r60148 r60565 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); -
trunk/wp-includes/ID3/getid3.php
r60148 r60565 388 388 protected $startup_warning = ''; 389 389 390 const VERSION = '1.9.2 3-202310190849';390 const VERSION = '1.9.24-202509040923'; 391 391 const FREAD_BUFFER_SIZE = 32768; 392 392 … … 410 410 if (preg_match('#([0-9]+) ?M#i', $memoryLimit, $matches)) { 411 411 // could be stored as "16M" rather than 16777216 for example 412 $memoryLimit = $matches[1] * 1048576;412 $memoryLimit = (int) $matches[1] * 1048576; 413 413 } elseif (preg_match('#([0-9]+) ?G#i', $memoryLimit, $matches)) { // The 'G' modifier is available since PHP 5.1.0 414 414 // could be stored as "2G" rather than 2147483648 for example 415 $memoryLimit = $matches[1] * 1073741824;415 $memoryLimit = (int) $matches[1] * 1073741824; 416 416 } 417 417 $this->memory_limit = $memoryLimit; … … 447 447 // Check for magic_quotes_gpc 448 448 if (function_exists('get_magic_quotes_gpc')) { 449 if (get_magic_quotes_gpc()) { // @phpstan-ignore-line449 if (get_magic_quotes_gpc()) { 450 450 $this->startup_error .= 'magic_quotes_gpc must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_gpc(0) and set_magic_quotes_gpc(1).'."\n"; 451 451 } … … 530 530 */ 531 531 public function setOption($optArray) { 532 if ( !is_array($optArray) ||empty($optArray)) {532 if (empty($optArray)) { 533 533 return false; 534 534 } … … 681 681 throw $e; 682 682 } 683 } else { 684 $this->warning('skipping check for '.$tag_name.' tags since option_tag_'.$tag_name.'=FALSE'); 683 685 } 684 686 } … … 1477 1479 1478 1480 // Misc other formats 1481 1482 // GPX - data - GPS Exchange Format 1483 'gpx' => array ( 1484 'pattern' => '^<\\?xml [^>]+>[\s]*<gpx ', 1485 'group' => 'misc', 1486 'module' => 'gpx', 1487 'mime_type' => 'application/gpx+xml', 1488 'fail_id3' => 'ERROR', 1489 'fail_ape' => 'ERROR', 1490 ), 1479 1491 1480 1492 // PAR2 - data - Parity Volume Set Specification 2.0 … … 1891 1903 // Calculate combined bitrate - audio + video 1892 1904 $CombinedBitrate = 0; 1893 $CombinedBitrate += (isset($this->info['audio']['bitrate']) ? $this->info['audio']['bitrate'] : 0);1894 $CombinedBitrate += (isset($this->info['video']['bitrate']) ? $this->info['video']['bitrate'] : 0);1905 $CombinedBitrate += (isset($this->info['audio']['bitrate']) && ($this->info['audio']['bitrate'] != 'free') ? $this->info['audio']['bitrate'] : 0); 1906 $CombinedBitrate += (isset($this->info['video']['bitrate']) ? $this->info['video']['bitrate'] : 0); 1895 1907 if (($CombinedBitrate > 0) && empty($this->info['bitrate'])) { 1896 1908 $this->info['bitrate'] = $CombinedBitrate; … … 1999 2011 return false; 2000 2012 } 2001 $this->info['audio']['compression_ratio'] = $this->info['audio']['bitrate'] / ($this->info['audio']['channels'] * $this->info['audio']['sample_rate'] * (!empty($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : 16)); 2013 if ($this->info['audio']['bitrate'] != 'free') { 2014 $this->info['audio']['compression_ratio'] = $this->info['audio']['bitrate'] / ($this->info['audio']['channels'] * $this->info['audio']['sample_rate'] * (!empty($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : 16)); 2015 } 2002 2016 2003 2017 if (!empty($this->info['audio']['streams'])) { -
trunk/wp-includes/ID3/module.audio-video.asf.php
r56486 r60565 337 337 $thisfile_asf['codec_list_object'] = array(); 338 338 /** @var mixed[] $thisfile_asf_codeclistobject */ 339 $thisfile_asf_codeclistobject = &$thisfile_asf['codec_list_object']; 339 $thisfile_asf_codeclistobject = &$thisfile_asf['codec_list_object']; // @phpstan-ignore-line 340 340 341 341 $thisfile_asf_codeclistobject['offset'] = $NextObjectOffset + $offset; … … 500 500 $thisfile_asf_scriptcommandobject['command_types_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); 501 501 $offset += 2; 502 for ($CommandTypesCounter = 0; $CommandTypesCounter < $thisfile_asf_scriptcommandobject['command_types_count']; $CommandTypesCounter++) { 503 $CommandTypeNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character 504 $offset += 2; 505 $thisfile_asf_scriptcommandobject['command_types'][$CommandTypesCounter]['name'] = substr($ASFHeaderData, $offset, $CommandTypeNameLength); 506 $offset += $CommandTypeNameLength; 507 } 508 for ($CommandsCounter = 0; $CommandsCounter < $thisfile_asf_scriptcommandobject['commands_count']; $CommandsCounter++) { 502 if ($thisfile_asf_scriptcommandobject['command_types_count'] > 0) { 503 $thisfile_asf_scriptcommandobject['command_types'] = array(); 504 for ($CommandTypesCounter = 0; $CommandTypesCounter < (int) $thisfile_asf_scriptcommandobject['command_types_count']; $CommandTypesCounter++) { 505 $CommandTypeNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character 506 $offset += 2; 507 $thisfile_asf_scriptcommandobject['command_types'][$CommandTypesCounter] = array(); 508 $thisfile_asf_scriptcommandobject['command_types'][$CommandTypesCounter]['name'] = substr($ASFHeaderData, $offset, $CommandTypeNameLength); 509 $offset += $CommandTypeNameLength; 510 } 511 } 512 for ($CommandsCounter = 0; $CommandsCounter < (int) $thisfile_asf_scriptcommandobject['commands_count']; $CommandsCounter++) { 509 513 $thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['presentation_time'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); 510 514 $offset += 4; … … 555 559 } 556 560 $thisfile_asf_markerobject['markers_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); 561 /** @var int|float|false $totalMakersCount */ 562 $totalMakersCount = $thisfile_asf_markerobject['markers_count']; 557 563 $offset += 4; 558 564 $thisfile_asf_markerobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); … … 566 572 $thisfile_asf_markerobject['name'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['name_length']); 567 573 $offset += $thisfile_asf_markerobject['name_length']; 568 for ($MarkersCounter = 0; $MarkersCounter < $thisfile_asf_markerobject['markers_count']; $MarkersCounter++) { 574 for ($MarkersCounter = 0; $MarkersCounter < $totalMakersCount; $MarkersCounter++) { 575 $thisfile_asf_markerobject['markers'][$MarkersCounter] = array(); 569 576 $thisfile_asf_markerobject['markers'][$MarkersCounter]['offset'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); 570 577 $offset += 8; … … 616 623 $thisfile_asf_bitratemutualexclusionobject['stream_numbers_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); 617 624 $offset += 2; 618 for ($StreamNumberCounter = 0; $StreamNumberCounter < $thisfile_asf_bitratemutualexclusionobject['stream_numbers_count']; $StreamNumberCounter++) {625 for ($StreamNumberCounter = 0; $StreamNumberCounter < (int) $thisfile_asf_bitratemutualexclusionobject['stream_numbers_count']; $StreamNumberCounter++) { 619 626 $thisfile_asf_bitratemutualexclusionobject['stream_numbers'][$StreamNumberCounter] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); 620 627 $offset += 2; … … 760 767 $thisfile_asf_extendedcontentdescriptionobject['content_descriptors_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); 761 768 $offset += 2; 762 for ($ExtendedContentDescriptorsCounter = 0; $ExtendedContentDescriptorsCounter < $thisfile_asf_extendedcontentdescriptionobject['content_descriptors_count']; $ExtendedContentDescriptorsCounter++) {769 for ($ExtendedContentDescriptorsCounter = 0; $ExtendedContentDescriptorsCounter < (int) $thisfile_asf_extendedcontentdescriptionobject['content_descriptors_count']; $ExtendedContentDescriptorsCounter++) { 763 770 // shortcut 764 771 $thisfile_asf_extendedcontentdescriptionobject['content_descriptors'][$ExtendedContentDescriptorsCounter] = array(); … … 958 965 $thisfile_asf_streambitratepropertiesobject['bitrate_records_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); 959 966 $offset += 2; 960 for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitratepropertiesobject['bitrate_records_count']; $BitrateRecordsCounter++) { 967 for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < (int) $thisfile_asf_streambitratepropertiesobject['bitrate_records_count']; $BitrateRecordsCounter++) { 968 $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter] = array(); 961 969 $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); 962 970 $offset += 2; … … 1007 1015 $ASFbitrateAudio = 0; 1008 1016 $ASFbitrateVideo = 0; 1009 for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitratepropertiesobject['bitrate_records_count']; $BitrateRecordsCounter++) {1017 for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < (int) $thisfile_asf_streambitratepropertiesobject['bitrate_records_count']; $BitrateRecordsCounter++) { 1010 1018 if (isset($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter])) { 1011 1019 switch ($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter]['type_raw']) { … … 1031 1039 } 1032 1040 } 1033 if (isset($thisfile_asf['stream_properties_object']) && is_array($thisfile_asf['stream_properties_object'])) {1041 if (isset($thisfile_asf['stream_properties_object'])) { 1034 1042 1035 1043 $thisfile_audio['bitrate'] = 0; … … 1068 1076 1069 1077 if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { // @phpstan-ignore-line 1070 foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) { 1078 foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) { // @phpstan-ignore-line 1071 1079 if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) { 1072 1080 $thisfile_asf_audiomedia_currentstream['bitrate'] = $dataarray['bitrate']; … … 1154 1162 1155 1163 if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { // @phpstan-ignore-line 1156 foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) { 1164 foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) { // @phpstan-ignore-line 1157 1165 if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) { 1158 1166 $thisfile_asf_videomedia_currentstream['bitrate'] = $dataarray['bitrate']; … … 1267 1275 $offset += 4; 1268 1276 $thisfile_asf_simpleindexobject['index_entries_count'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 4)); 1269 $offset += 4; 1270 1271 $IndexEntriesData = $SimpleIndexObjectData.$this->fread(6 * $thisfile_asf_simpleindexobject['index_entries_count']); 1272 for ($IndexEntriesCounter = 0; $IndexEntriesCounter < $thisfile_asf_simpleindexobject['index_entries_count']; $IndexEntriesCounter++) { 1277 /** @var int|float|false $totalIndexEntriesCount */ 1278 $totalIndexEntriesCount = $thisfile_asf_simpleindexobject['index_entries_count']; 1279 $offset += 4; 1280 1281 $IndexEntriesData = $SimpleIndexObjectData.$this->fread(6 * $totalIndexEntriesCount); 1282 for ($IndexEntriesCounter = 0; $IndexEntriesCounter < $totalIndexEntriesCount; $IndexEntriesCounter++) { 1283 $thisfile_asf_simpleindexobject['index_entries'][$IndexEntriesCounter] = array(); 1273 1284 $thisfile_asf_simpleindexobject['index_entries'][$IndexEntriesCounter]['packet_number'] = getid3_lib::LittleEndian2Int(substr($IndexEntriesData, $offset, 4)); 1274 1285 $offset += 4; … … 1321 1332 1322 1333 $ASFIndexObjectData .= $this->fread(4 * $thisfile_asf_asfindexobject['index_specifiers_count']); 1323 for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) {1334 for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < (int) $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) { 1324 1335 $IndexSpecifierStreamNumber = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2)); 1325 1336 $offset += 2; 1337 $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter] = array(); 1326 1338 $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['stream_number'] = $IndexSpecifierStreamNumber; 1327 1339 $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2)); … … 1332 1344 $ASFIndexObjectData .= $this->fread(4); 1333 1345 $thisfile_asf_asfindexobject['index_entry_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4)); 1346 /** @var int|float|false $totalIndexEntryCount */ 1347 $totalIndexEntryCount = $thisfile_asf_asfindexobject['index_entry_count']; 1334 1348 $offset += 4; 1335 1349 1336 1350 $ASFIndexObjectData .= $this->fread(8 * $thisfile_asf_asfindexobject['index_specifiers_count']); 1337 for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) {1351 for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < (int) $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) { 1338 1352 $thisfile_asf_asfindexobject['block_positions'][$IndexSpecifiersCounter] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 8)); 1339 1353 $offset += 8; … … 1341 1355 1342 1356 $ASFIndexObjectData .= $this->fread(4 * $thisfile_asf_asfindexobject['index_specifiers_count'] * $thisfile_asf_asfindexobject['index_entry_count']); 1343 for ($IndexEntryCounter = 0; $IndexEntryCounter < $t hisfile_asf_asfindexobject['index_entry_count']; $IndexEntryCounter++) {1344 for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) {1357 for ($IndexEntryCounter = 0; $IndexEntryCounter < $totalIndexEntryCount; $IndexEntryCounter++) { 1358 for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < (int) $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) { 1345 1359 $thisfile_asf_asfindexobject['offsets'][$IndexSpecifiersCounter][$IndexEntryCounter] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4)); 1346 1360 $offset += 4; -
trunk/wp-includes/ID3/module.audio-video.quicktime.php
r60136 r60565 40 40 41 41 /** 42 * real ugly, but so is the QuickTime structure that stores keys and values in different multi-nested locations that are hard to relate to each other 43 * https://github.com/JamesHeinrich/getID3/issues/214 44 * 45 * @var int 46 */ 47 private $metaDATAkey = 1; 48 49 /** 42 50 * @return bool 43 51 */ … … 45 53 $info = &$this->getid3->info; 46 54 55 $this->metaDATAkey = 1; 47 56 $info['fileformat'] = 'quicktime'; 48 57 $info['quicktime']['hinting'] = false; … … 148 157 149 158 if (strlen($lat_deg) == 2) { // [+-]DD.D 150 $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim($lat_deg, '0').$lat_deg_dec);159 $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * (float) (ltrim($lat_deg, '0').$lat_deg_dec); 151 160 } elseif (strlen($lat_deg) == 4) { // [+-]DDMM.M 152 $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0').$lat_deg_dec/ 60);161 $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * (int) ltrim(substr($lat_deg, 0, 2), '0') + ((float) (ltrim(substr($lat_deg, 2, 2), '0').$lat_deg_dec) / 60); 153 162 } elseif (strlen($lat_deg) == 6) { // [+-]DDMMSS.S 154 $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval((int) ltrim(substr($lat_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lat_deg, 4, 2), '0').$lat_deg_dec/ 3600);163 $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * (int) ltrim(substr($lat_deg, 0, 2), '0') + ((int) ltrim(substr($lat_deg, 2, 2), '0') / 60) + ((float) (ltrim(substr($lat_deg, 4, 2), '0').$lat_deg_dec) / 3600); 155 164 } 156 165 157 166 if (strlen($lon_deg) == 3) { // [+-]DDD.D 158 $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim($lon_deg, '0').$lon_deg_dec);167 $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * (float) (ltrim($lon_deg, '0').$lon_deg_dec); 159 168 } elseif (strlen($lon_deg) == 5) { // [+-]DDDMM.M 160 $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0').$lon_deg_dec/ 60);169 $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * (int) ltrim(substr($lon_deg, 0, 2), '0') + ((float) (ltrim(substr($lon_deg, 2, 2), '0').$lon_deg_dec) / 60); 161 170 } elseif (strlen($lon_deg) == 7) { // [+-]DDDMMSS.S 162 $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval((int) ltrim(substr($lon_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lon_deg, 4, 2), '0').$lon_deg_dec/ 3600);171 $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * (int) ltrim(substr($lon_deg, 0, 2), '0') + ((int) ltrim(substr($lon_deg, 2, 2), '0') / 60) + ((float) (ltrim(substr($lon_deg, 4, 2), '0').$lon_deg_dec) / 3600); 163 172 } 164 173 165 174 if (strlen($alt_deg) == 3) { // [+-]DDD.D 166 $ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * floatval(ltrim($alt_deg, '0').$alt_deg_dec);175 $ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * (float) (ltrim($alt_deg, '0').$alt_deg_dec); 167 176 } elseif (strlen($alt_deg) == 5) { // [+-]DDDMM.M 168 $ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval(ltrim(substr($alt_deg, 2, 2), '0').$alt_deg_dec/ 60);177 $ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * (int) ltrim(substr($alt_deg, 0, 2), '0') + ((float) (ltrim(substr($alt_deg, 2, 2), '0').$alt_deg_dec) / 60); 169 178 } elseif (strlen($alt_deg) == 7) { // [+-]DDDMMSS.S 170 $ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval((int) ltrim(substr($alt_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($alt_deg, 4, 2), '0').$alt_deg_dec/ 3600);179 $ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * (int) ltrim(substr($alt_deg, 0, 2), '0') + ((int) ltrim(substr($alt_deg, 2, 2), '0') / 60) + ((float) (ltrim(substr($alt_deg, 4, 2), '0').$alt_deg_dec) / 3600); 171 180 } 172 181 … … 214 223 } else { 215 224 $info['mime_type'] = 'video/mp4'; 225 } 226 } 227 if (!empty($info['quicktime']['ftyp']['signature']) && in_array($info['quicktime']['ftyp']['signature'], array('heic','heix','hevc','hevx','heim','heis','hevm','hevs'))) { 228 if ($info['mime_type'] == 'video/quicktime') { // default value, as we 229 // https://en.wikipedia.org/wiki/High_Efficiency_Image_File_Format 230 $this->error('HEIF files not currently supported'); 231 switch ($info['quicktime']['ftyp']['signature']) { 232 // https://github.com/strukturag/libheif/issues/83 (comment by Dirk Farin 2018-09-14) 233 case 'heic': // the usual HEIF images 234 case 'heix': // 10bit images, or anything that uses h265 with range extension 235 case 'hevc': // brands for image sequences 236 case 'hevx': // brands for image sequences 237 case 'heim': // multiview 238 case 'heis': // scalable 239 case 'hevm': // multiview sequence 240 case 'hevs': // scalable sequence 241 $info['fileformat'] = 'heif'; 242 $info['mime_type'] = 'image/heif'; 243 break; 244 } 216 245 } 217 246 } … … 794 823 795 824 $stsdEntriesDataOffset = 8; 796 for ($i = 0; $i < $atom_structure['number_entries']; $i++) {825 for ($i = 0; $i < (int) $atom_structure['number_entries']; $i++) { 797 826 $atom_structure['sample_description_table'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 4)); 798 827 $stsdEntriesDataOffset += 4; … … 830 859 // video tracks 831 860 // http://developer.apple.com/library/mac/#documentation/QuickTime/QTFF/QTFFChap3/qtff3.html 832 $atom_structure['sample_description_table'][$i]['temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); 833 $atom_structure['sample_description_table'][$i]['spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); 834 $atom_structure['sample_description_table'][$i]['width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); 835 $atom_structure['sample_description_table'][$i]['height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); 836 $atom_structure['sample_description_table'][$i]['resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); 837 $atom_structure['sample_description_table'][$i]['resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); 838 $atom_structure['sample_description_table'][$i]['data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 4)); 839 $atom_structure['sample_description_table'][$i]['frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 36, 2)); 840 $atom_structure['sample_description_table'][$i]['compressor_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 38, 4); 841 $atom_structure['sample_description_table'][$i]['pixel_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 42, 2)); 842 $atom_structure['sample_description_table'][$i]['color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 44, 2)); 861 // https://developer.apple.com/documentation/quicktime-file-format 862 $STSDvOffset = 8; 863 $atom_structure['sample_description_table'][$i]['temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], $STSDvOffset, 4)); $STSDvOffset += 4; 864 $atom_structure['sample_description_table'][$i]['spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], $STSDvOffset, 4)); $STSDvOffset += 4; 865 $atom_structure['sample_description_table'][$i]['width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], $STSDvOffset, 2)); $STSDvOffset += 2; 866 $atom_structure['sample_description_table'][$i]['height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], $STSDvOffset, 2)); $STSDvOffset += 2; 867 $atom_structure['sample_description_table'][$i]['resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], $STSDvOffset, 4)); $STSDvOffset += 4; 868 $atom_structure['sample_description_table'][$i]['resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], $STSDvOffset, 4)); $STSDvOffset += 4; 869 $atom_structure['sample_description_table'][$i]['data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], $STSDvOffset, 4)); $STSDvOffset += 4; 870 $atom_structure['sample_description_table'][$i]['frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], $STSDvOffset, 2)); $STSDvOffset += 2; 871 $atom_structure['sample_description_table'][$i]['compressor_name'] = substr($atom_structure['sample_description_table'][$i]['data'], $STSDvOffset, 32) ; $STSDvOffset += 32; 872 $atom_structure['sample_description_table'][$i]['compressor_name'] = $this->MaybePascal2String(rtrim($atom_structure['sample_description_table'][$i]['compressor_name'], "\x00")); // https://github.com/JamesHeinrich/getID3/issues/452 873 $atom_structure['sample_description_table'][$i]['pixel_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], $STSDvOffset, 2)); $STSDvOffset += 2; 874 $atom_structure['sample_description_table'][$i]['color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], $STSDvOffset, 2)); $STSDvOffset += 2; 843 875 844 876 switch ($atom_structure['sample_description_table'][$i]['data_format']) { … … 1642 1674 $info['quicktime']['comments']['gps_latitude'][] = floatval($latitude); 1643 1675 $info['quicktime']['comments']['gps_longitude'][] = floatval($longitude); 1644 if (!empty($altitude)) { 1676 if (!empty($altitude)) { // @phpstan-ignore-line 1645 1677 $info['quicktime']['comments']['gps_altitude'][] = floatval($altitude); 1646 1678 } … … 1722 1754 1723 1755 case 'data': // metaDATA atom 1724 static $metaDATAkey = 1; // real ugly, but so is the QuickTime structure that stores keys and values in different multinested locations that are hard to relate to each other1725 1756 // seems to be 2 bytes language code (ASCII), 2 bytes unknown (set to 0x10B5 in sample I have), remainder is useful data 1726 1757 $atom_structure['language'] = substr($atom_data, 4 + 0, 2); 1727 1758 $atom_structure['unknown'] = getid3_lib::BigEndian2Int(substr($atom_data, 4 + 2, 2)); 1728 1759 $atom_structure['data'] = substr($atom_data, 4 + 4); 1729 $atom_structure['key_name'] = (isset($info['quicktime']['temp_meta_key_names'][$metaDATAkey]) ? $info['quicktime']['temp_meta_key_names'][$metaDATAkey] : ''); 1730 $metaDATAkey++; 1760 $atom_structure['key_name'] = (isset($info['quicktime']['temp_meta_key_names'][$this->metaDATAkey]) ? $info['quicktime']['temp_meta_key_names'][$this->metaDATAkey] : ''); 1761 $this->metaDATAkey++; 1762 1763 switch ($atom_structure['key_name']) { 1764 case 'com.android.capture.fps': 1765 $atom_structure['data'] = getid3_lib::BigEndian2Float($atom_structure['data']); 1766 break; 1767 } 1731 1768 1732 1769 if ($atom_structure['key_name'] && $atom_structure['data']) { 1733 @$info['quicktime']['comments'][str_replace('com.a pple.quicktime.', '', $atom_structure['key_name'])][] = $atom_structure['data'];1770 @$info['quicktime']['comments'][str_replace('com.android.', '', str_replace('com.apple.quicktime.', '', $atom_structure['key_name']))][] = $atom_structure['data']; 1734 1771 } 1735 1772 break; … … 1972 2009 preg_match('#^([0-9]{1,3})([0-9]{2}\\.[0-9]+)$#', $GPS_this_GPRMC['raw'][$latlon], $matches); 1973 2010 list($dummy, $deg, $min) = $matches; 1974 $GPS_this_GPRMC[$latlon] = $deg + ($min / 60);2011 $GPS_this_GPRMC[$latlon] = (int) $deg + ((float) $min / 60); 1975 2012 } 1976 2013 $GPS_this_GPRMC['latitude'] *= (($GPS_this_GPRMC['raw']['latitude_direction'] == 'S') ? -1 : 1); … … 1979 2016 $GPS_this_GPRMC['heading'] = $GPS_this_GPRMC['raw']['angle']; 1980 2017 $GPS_this_GPRMC['speed_knot'] = $GPS_this_GPRMC['raw']['knots']; 1981 $GPS_this_GPRMC['speed_kmh'] = $GPS_this_GPRMC['raw']['knots'] * 1.852;2018 $GPS_this_GPRMC['speed_kmh'] = (float) $GPS_this_GPRMC['raw']['knots'] * 1.852; 1982 2019 if ($GPS_this_GPRMC['raw']['variation']) { 1983 $GPS_this_GPRMC['variation'] = $GPS_this_GPRMC['raw']['variation'];2020 $GPS_this_GPRMC['variation'] = (float) $GPS_this_GPRMC['raw']['variation']; 1984 2021 $GPS_this_GPRMC['variation'] *= (($GPS_this_GPRMC['raw']['variation_direction'] == 'W') ? -1 : 1); 1985 2022 } … … 2115 2152 $esds_offset += 1; 2116 2153 if ($atom_structure['ES_DescrTag'] != 0x03) { 2117 $this->warning('expecting esds.ES_DescrTag = 0x03, found 0x'. getid3_lib::PrintHexBytes($atom_structure['ES_DescrTag']).'), at offset '.$atom_structure['offset']);2154 $this->warning('expecting esds.ES_DescrTag = 0x03, found 0x'.sprintf('%02X', $atom_structure['ES_DescrTag']).', at offset '.$atom_structure['offset']); 2118 2155 break; 2119 2156 } … … 2144 2181 $esds_offset += 1; 2145 2182 if ($atom_structure['ES_DecoderConfigDescrTag'] != 0x04) { 2146 $this->warning('expecting esds.ES_DecoderConfigDescrTag = 0x04, found 0x'. getid3_lib::PrintHexBytes($atom_structure['ES_DecoderConfigDescrTag']).'), at offset '.$atom_structure['offset']);2183 $this->warning('expecting esds.ES_DecoderConfigDescrTag = 0x04, found 0x'.sprintf('%02X', $atom_structure['ES_DecoderConfigDescrTag']).', at offset '.$atom_structure['offset']); 2147 2184 break; 2148 2185 } … … 2175 2212 $esds_offset += 1; 2176 2213 if ($atom_structure['ES_DecSpecificInfoTag'] != 0x05) { 2177 $this->warning('expecting esds.ES_DecSpecificInfoTag = 0x05, found 0x'. getid3_lib::PrintHexBytes($atom_structure['ES_DecSpecificInfoTag']).'), at offset '.$atom_structure['offset']);2214 $this->warning('expecting esds.ES_DecSpecificInfoTag = 0x05, found 0x'.sprintf('%02X', $atom_structure['ES_DecSpecificInfoTag']).', at offset '.$atom_structure['offset']); 2178 2215 break; 2179 2216 } … … 2186 2223 $esds_offset += 1; 2187 2224 if ($atom_structure['ES_SLConfigDescrTag'] != 0x06) { 2188 $this->warning('expecting esds.ES_SLConfigDescrTag = 0x05, found 0x'. getid3_lib::PrintHexBytes($atom_structure['ES_SLConfigDescrTag']).'), at offset '.$atom_structure['offset']);2225 $this->warning('expecting esds.ES_SLConfigDescrTag = 0x05, found 0x'.sprintf('%02X', $atom_structure['ES_SLConfigDescrTag']).', at offset '.$atom_structure['offset']); 2189 2226 break; 2190 2227 } -
trunk/wp-includes/ID3/module.audio-video.riff.php
r56486 r60565 68 68 $RIFFsubtype = substr($RIFFheader, 8, 4); 69 69 70 if ($RIFFsize == "\x00\x00\x00\x00") { 71 // https://github.com/JamesHeinrich/getID3/issues/468 72 // may occur in streaming files where the data size is unknown 73 $thisfile_riff['header_size'] = $info['avdataend'] - 8; 74 $this->warning('RIFF size field is empty, assuming the correct value is filesize-8 ('.$thisfile_riff['header_size'].')'); 75 } else { 76 $thisfile_riff['header_size'] = $this->EitherEndian2Int($RIFFsize); 77 } 78 70 79 switch ($RIFFtype) { 71 72 80 case 'FORM': // AIFF, AIFC 73 81 //$info['fileformat'] = 'aiff'; 74 82 $this->container = 'aiff'; 75 $thisfile_riff['header_size'] = $this->EitherEndian2Int($RIFFsize);76 83 $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4)); 77 84 break; … … 82 89 //$info['fileformat'] = 'riff'; 83 90 $this->container = 'riff'; 84 $thisfile_riff['header_size'] = $this->EitherEndian2Int($RIFFsize);85 91 if ($RIFFsubtype == 'RMP3') { 86 92 // RMP3 is identical to WAVE, just renamed. Used by [unknown program] when creating RIFF-MP3s … … 99 105 } 100 106 101 $nextRIFFoffset = $Original['avdataoffset'] + 8 +$thisfile_riff['header_size']; // 8 = "RIFF" + 32-bit offset107 $nextRIFFoffset = (int) $Original['avdataoffset'] + 8 + (int) $thisfile_riff['header_size']; // 8 = "RIFF" + 32-bit offset 102 108 while ($nextRIFFoffset < min($info['filesize'], $info['avdataend'])) { 103 109 try { … … 306 312 // Keep only string as far as first null byte, discard rest of fixed-width data 307 313 // https://github.com/JamesHeinrich/getID3/issues/263 308 $null_terminator_offset = strpos($thisfile_riff_WAVE_bext_0[$bext_key], "\x00"); 309 $thisfile_riff_WAVE_bext_0[$bext_key] = substr($thisfile_riff_WAVE_bext_0[$bext_key], 0, $null_terminator_offset); 314 // https://github.com/JamesHeinrich/getID3/issues/430 315 $null_terminator_rows = explode("\x00", $thisfile_riff_WAVE_bext_0[$bext_key]); 316 $thisfile_riff_WAVE_bext_0[$bext_key] = $null_terminator_rows[0]; 310 317 } 311 318 … … 473 480 if (substr($value, 0, 3) == '[{"') { 474 481 if ($decoded = @json_decode($value, true)) { 475 if ( !empty($decoded) && (count($decoded) == 1)) {482 if (count($decoded) === 1) { 476 483 $value = $decoded[0]; 477 484 } else { … … 1133 1140 foreach ($CommentsChunkNames as $key => $value) { 1134 1141 if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) { 1135 $thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data']; 1142 // https://github.com/JamesHeinrich/getID3/issues/430 1143 $null_terminator_rows = explode("\x00", $thisfile_riff[$RIFFsubtype][$key][0]['data']); 1144 $thisfile_riff['comments'][$value][] = $null_terminator_rows[0]; 1136 1145 } 1137 1146 } … … 1225 1234 foreach ($CommentsChunkNames as $key => $value) { 1226 1235 if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) { 1227 $thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data']; 1236 // https://github.com/JamesHeinrich/getID3/issues/430 1237 $null_terminator_rows = explode("\x00", $thisfile_riff[$RIFFsubtype][$key][0]['data']); 1238 $thisfile_riff['comments'][$value][] = $null_terminator_rows[0]; 1228 1239 } 1229 1240 } … … 1365 1376 1366 1377 if ($info['playtime_seconds'] > 0) { 1367 if ( isset($thisfile_riff_audio) && isset($thisfile_riff_video)) {1378 if ($thisfile_riff_audio !== null && $thisfile_riff_video !== null) { 1368 1379 1369 1380 if (!isset($info['bitrate'])) { … … 1371 1382 } 1372 1383 1373 } elseif ( isset($thisfile_riff_audio) && !isset($thisfile_riff_video)) {1384 } elseif ($thisfile_riff_audio !== null && $thisfile_riff_video === null) { // @phpstan-ignore-line 1374 1385 1375 1386 if (!isset($thisfile_audio['bitrate'])) { … … 1377 1388 } 1378 1389 1379 } elseif ( !isset($thisfile_riff_audio) && isset($thisfile_riff_video)) {1390 } elseif ($thisfile_riff_audio === null && $thisfile_riff_video !== null) { 1380 1391 1381 1392 if (!isset($thisfile_video['bitrate'])) { … … 1602 1613 break; 1603 1614 } 1604 if (($chunksize == 0) && ($chunkname != 'JUNK')) { 1605 $this->warning('Chunk ('.$chunkname.') size at offset '.($this->ftell() - 4).' is zero. Aborting RIFF parsing.'); 1606 break; 1615 if ($chunksize == 0) { 1616 if ($chunkname == 'JUNK') { 1617 // this is allowed 1618 } elseif ($chunkname == 'data') { 1619 // https://github.com/JamesHeinrich/getID3/issues/468 1620 // may occur in streaming files where the data size is unknown 1621 $chunksize = $info['avdataend'] - $this->ftell(); 1622 $this->warning('RIFF.data size field is empty, assuming the correct value is filesize-offset ('.$chunksize.')'); 1623 } else { 1624 $this->warning('Chunk ('.$chunkname.') size at offset '.($this->ftell() - 4).' is zero. Aborting RIFF parsing.'); 1625 break; 1626 } 1607 1627 } 1608 1628 if (($chunksize % 2) != 0) { … … 1694 1714 } 1695 1715 $thisindex = 0; 1696 if (isset($RIFFchunk[$chunkname]) && is_array($RIFFchunk[$chunkname])) {1716 if (isset($RIFFchunk[$chunkname])) { 1697 1717 $thisindex = count($RIFFchunk[$chunkname]); 1698 1718 } -
trunk/wp-includes/ID3/module.audio.mp3.php
r56486 r60565 306 306 307 307 if ($info['audio']['bitrate_mode'] == 'cbr') { 308 $encoder_options = strtoupper($info['audio']['bitrate_mode']).round($info['audio']['bitrate'] / 1000); 308 if ($info['audio']['bitrate'] == 'free') { 309 $encoder_options = strtoupper($info['audio']['bitrate_mode']); 310 } else { 311 $encoder_options = strtoupper($info['audio']['bitrate_mode']).round($info['audio']['bitrate'] / 1000); 312 } 309 313 } else { 310 314 $encoder_options = strtoupper($info['audio']['bitrate_mode']); … … 316 320 } 317 321 318 if (isset($thisfile_mpeg_audio['bitrate']) && $thisfile_mpeg_audio['bitrate'] === 'free') {322 if (isset($thisfile_mpeg_audio['bitrate']) && ($thisfile_mpeg_audio['bitrate'] === 'free')) { 319 323 $encoder_options .= ' --freeformat'; 320 324 } … … 713 717 $info['audio']['bitrate'] = $framelengthfloat * $thisfile_mpeg_audio['sample_rate'] * (2 / $info['audio']['channels']) / 144; 714 718 } 715 $thisfile_mpeg_audio['framelength'] = floor($framelengthfloat);719 $thisfile_mpeg_audio['framelength'] = (int) floor($framelengthfloat); 716 720 } 717 721 … … 920 924 921 925 // LAME CBR 922 if ( $thisfile_mpeg_audio_lame_raw['vbr_method'] == 1 && $thisfile_mpeg_audio['bitrate'] !== 'free') {926 if (($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1) && ($thisfile_mpeg_audio['bitrate'] !== 'free')) { 923 927 924 928 $thisfile_mpeg_audio['bitrate_mode'] = 'cbr'; … … 1175 1179 $nextframetestarray = array('error' => array(), 'warning' => array(), 'avdataend' => $info['avdataend'], 'avdataoffset'=>$info['avdataoffset']); 1176 1180 if ($this->decodeMPEGaudioHeader($nextframetestoffset, $nextframetestarray, false)) { 1177 /** @phpstan-ignore-next-line */1178 1181 getid3_lib::safe_inc($info['mp3_validity_check_bitrates'][$nextframetestarray['mpeg']['audio']['bitrate']]); 1179 1182 if ($ScanAsCBR) { … … 1187 1190 // next frame is OK, get ready to check the one after that 1188 1191 if (isset($nextframetestarray['mpeg']['audio']['framelength']) && ($nextframetestarray['mpeg']['audio']['framelength'] > 0)) { 1189 $nextframetestoffset += $nextframetestarray['mpeg']['audio']['framelength'];1192 $nextframetestoffset += (int) $nextframetestarray['mpeg']['audio']['framelength']; 1190 1193 } else { 1191 1194 $this->error('Frame at offset ('.$offset.') is has an invalid frame length.'); … … 1762 1765 if (empty($MPEGaudioBitrate)) { 1763 1766 $MPEGaudioBitrate = array ( 1764 '1' => array (1 => array('free', 32000, 64000, 96000, 128000, 160000, 192000, 224000, 256000, 288000, 320000, 352000, 384000, 416000, 448000), 1765 2 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000), 1766 3 => array('free', 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000) 1767 ), 1768 1769 '2' => array (1 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000, 176000, 192000, 224000, 256000), 1770 2 => array('free', 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000), 1771 ) 1767 '1' => array( 1768 1 => array('free', 32000, 64000, 96000, 128000, 160000, 192000, 224000, 256000, 288000, 320000, 352000, 384000, 416000, 448000), 1769 2 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000), 1770 3 => array('free', 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000) 1771 ), 1772 '2' => array( 1773 1 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000, 176000, 192000, 224000, 256000), 1774 2 => array('free', 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000), 1775 ), 1772 1776 ); 1773 1777 $MPEGaudioBitrate['2'][3] = $MPEGaudioBitrate['2'][2]; -
trunk/wp-includes/ID3/module.audio.ogg.php
r60148 r60565 351 351 $LastChunkOfOgg = strrev($this->fread($this->getid3->fread_buffer_size())); 352 352 if ($LastOggSpostion = strpos($LastChunkOfOgg, 'SggO')) { 353 if (substr($LastChunkOfOgg, 13, 8) === "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF") { 354 // https://github.com/JamesHeinrich/getID3/issues/450 355 // "Sometimes, Opus encoders (WhatsApp voice registrations and others) add a special last header with a granule duration of 0xFFFFFFFFFFFFFF. 356 // This value indicates "this is the end," but must be ignored; otherwise, it makes calculations wrong." 357 $LastOggSpostion = strpos($LastChunkOfOgg, 'SggO', $LastOggSpostion + 1); 358 } 353 359 $this->fseek($info['avdataend'] - ($LastOggSpostion + strlen('SggO'))); 354 360 $info['avdataend'] = $this->ftell(); -
trunk/wp-includes/ID3/module.tag.apetag.php
r56486 r60565 42 42 $this->warning('Unable to check for APEtags because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'); 43 43 return false; 44 } 45 if (PHP_INT_MAX == 2147483647) { 46 // https://github.com/JamesHeinrich/getID3/issues/439 47 $this->warning('APEtag flags may not be parsed correctly on 32-bit PHP'); 44 48 } 45 49 -
trunk/wp-includes/ID3/module.tag.id3v2.php
r56486 r60565 660 660 // Identifier <up to 64 bytes binary data> 661 661 $exploded = explode("\x00", $parsedFrame['data'], 2); 662 $parsedFrame['ownerid'] = (isset($exploded[0]) ? $exploded[0] : '');662 $parsedFrame['ownerid'] = $exploded[0]; 663 663 $parsedFrame['data'] = (isset($exploded[1]) ? $exploded[1] : ''); 664 664 … … 1069 1069 1070 1070 $frame_remainingdata = substr($frame_remainingdata, $frame_terminatorpos + strlen($frame_textencoding_terminator)); 1071 if (($timestampindex == 0) && (ord($frame_remainingdata[0]) != 0)) { 1072 // timestamp probably omitted for first data item 1073 } else { 1074 $parsedFrame['lyrics'][$timestampindex]['timestamp'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 4)); 1075 $frame_remainingdata = substr($frame_remainingdata, 4); 1071 if (strlen($frame_remainingdata)) { // https://github.com/JamesHeinrich/getID3/issues/444 1072 if (($timestampindex == 0) && (ord($frame_remainingdata[0]) != 0)) { 1073 // timestamp probably omitted for first data item 1074 } else { 1075 $parsedFrame['lyrics'][$timestampindex]['timestamp'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 4)); 1076 $frame_remainingdata = substr($frame_remainingdata, 4); 1077 } 1078 $timestampindex++; 1076 1079 } 1077 $timestampindex++;1078 1080 } 1079 1081 } … … 1305 1307 1306 1308 $frame_offset = 0; 1307 $parsedFrame['adjustmentbits'] = substr($parsedFrame['data'], $frame_offset++, 1);1309 $parsedFrame['adjustmentbits'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); 1308 1310 $frame_adjustmentbytes = ceil($parsedFrame['adjustmentbits'] / 8); 1309 1311 -
trunk/wp-includes/ID3/module.tag.lyrics3.php
r51846 r60565 111 111 if (isset($info['lyrics3']['tag_offset_start'])) { 112 112 $GETID3_ERRORARRAY = &$info['warning']; 113 getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, true); 114 $getid3_temp = new getID3(); 115 $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp); 116 $getid3_apetag = new getid3_apetag($getid3_temp); 117 $getid3_apetag->overrideendoffset = $info['lyrics3']['tag_offset_start']; 118 $getid3_apetag->Analyze(); 119 if (!empty($getid3_temp->info['ape'])) { 120 $info['ape'] = $getid3_temp->info['ape']; 121 } 122 if (!empty($getid3_temp->info['replay_gain'])) { 123 $info['replay_gain'] = $getid3_temp->info['replay_gain']; 124 } 125 unset($getid3_temp, $getid3_apetag); 113 if ($this->getid3->option_tag_apetag) { 114 getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, true); 115 $getid3_temp = new getID3(); 116 $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp); 117 $getid3_apetag = new getid3_apetag($getid3_temp); 118 $getid3_apetag->overrideendoffset = $info['lyrics3']['tag_offset_start']; 119 $getid3_apetag->Analyze(); 120 if (!empty($getid3_temp->info['ape'])) { 121 $info['ape'] = $getid3_temp->info['ape']; 122 } 123 if (!empty($getid3_temp->info['replay_gain'])) { 124 $info['replay_gain'] = $getid3_temp->info['replay_gain']; 125 } 126 unset($getid3_temp, $getid3_apetag); 127 } else { 128 $this->warning('Unable to check for Lyrics3 and APE tags interaction since option_tag_apetag=FALSE'); 129 } 126 130 } else { 127 131 $this->warning('Lyrics3 and APE tags appear to have become entangled (most likely due to updating the APE tags with a non-Lyrics3-aware tagger)'); … … 228 232 if (strpos($imagestring, '||') !== false) { 229 233 $imagearray = explode('||', $imagestring); 230 $ParsedLyrics3['images'][$key]['filename'] = (isset($imagearray[0]) ? $imagearray[0] : '');234 $ParsedLyrics3['images'][$key]['filename'] = $imagearray[0]; 231 235 $ParsedLyrics3['images'][$key]['description'] = (isset($imagearray[1]) ? $imagearray[1] : ''); 232 236 $ParsedLyrics3['images'][$key]['timestamp'] = $this->Lyrics3Timestamp2Seconds(isset($imagearray[2]) ? $imagearray[2] : ''); … … 273 277 public function Lyrics3Timestamp2Seconds($rawtimestamp) { 274 278 if (preg_match('#^\\[([0-9]{2}):([0-9]{2})\\]$#', $rawtimestamp, $regs)) { 275 return (int) (( $regs[1] * 60) +$regs[2]);279 return (int) (((int) $regs[1] * 60) + (int) $regs[2]); 276 280 } 277 281 return false; … … 288 292 foreach ($lyricsarray as $key => $lyricline) { 289 293 $regs = array(); 290 unset($thislinetimestamps);294 $thislinetimestamps = array(); 291 295 while (preg_match('#^(\\[[0-9]{2}:[0-9]{2}\\])#', $lyricline, $regs)) { 292 296 $thislinetimestamps[] = $this->Lyrics3Timestamp2Seconds($regs[0]); … … 294 298 } 295 299 $notimestamplyricsarray[$key] = $lyricline; 296 if ( isset($thislinetimestamps) && is_array($thislinetimestamps)) {300 if (count($thislinetimestamps) > 0) { 297 301 sort($thislinetimestamps); 298 302 foreach ($thislinetimestamps as $timestampkey => $timestamp) { 299 if (isset($Lyrics3data[' synchedlyrics'][$timestamp])) {303 if (isset($Lyrics3data['comments']['synchedlyrics'][$timestamp])) { 300 304 // timestamps only have a 1-second resolution, it's possible that multiple lines 301 305 // could have the same timestamp, if so, append 302 $Lyrics3data[' synchedlyrics'][$timestamp] .= "\r\n".$lyricline;306 $Lyrics3data['comments']['synchedlyrics'][$timestamp] .= "\r\n".$lyricline; 303 307 } else { 304 $Lyrics3data[' synchedlyrics'][$timestamp] = $lyricline;305 } 306 } 307 } 308 } 309 $Lyrics3data[' unsynchedlyrics'] = implode("\r\n", $notimestamplyricsarray);310 if (isset($Lyrics3data[' synchedlyrics']) && is_array($Lyrics3data['synchedlyrics'])) {311 ksort($Lyrics3data[' synchedlyrics']);308 $Lyrics3data['comments']['synchedlyrics'][$timestamp] = $lyricline; 309 } 310 } 311 } 312 } 313 $Lyrics3data['comments']['unsynchedlyrics'][0] = implode("\r\n", $notimestamplyricsarray); 314 if (isset($Lyrics3data['comments']['synchedlyrics']) && is_array($Lyrics3data['comments']['synchedlyrics'])) { 315 ksort($Lyrics3data['comments']['synchedlyrics']); 312 316 } 313 317 return true; -
trunk/wp-includes/version.php
r60562 r60565 17 17 * @global string $wp_version 18 18 */ 19 $wp_version = '7.0-alpha-6125 0';19 $wp_version = '7.0-alpha-61253'; 20 20 21 21 /**
Note: See TracChangeset
for help on using the changeset viewer.