This commit is contained in:
Hanson.xyz Dev
2026-01-04 17:50:08 -06:00
parent 7e45ce0756
commit acc8ac87a0
4131 changed files with 232562 additions and 250244 deletions
+26 -17
View File
@@ -387,7 +387,7 @@ class getID3
*/
protected $startup_warning = '';
const VERSION = '1.9.23-202310190849';
const VERSION = '1.9.24-202509040923';
const FREAD_BUFFER_SIZE = 32768;
const ATTACHMENTS_NONE = false;
@@ -409,10 +409,10 @@ class getID3
$memoryLimit = ini_get('memory_limit');
if (preg_match('#([0-9]+) ?M#i', $memoryLimit, $matches)) {
// could be stored as "16M" rather than 16777216 for example
$memoryLimit = $matches[1] * 1048576;
$memoryLimit = (int) $matches[1] * 1048576;
} elseif (preg_match('#([0-9]+) ?G#i', $memoryLimit, $matches)) { // The 'G' modifier is available since PHP 5.1.0
// could be stored as "2G" rather than 2147483648 for example
$memoryLimit = $matches[1] * 1073741824;
$memoryLimit = (int) $matches[1] * 1073741824;
}
$this->memory_limit = $memoryLimit;
@@ -425,16 +425,14 @@ class getID3
}
// Check safe_mode off
if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved
if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
$this->warning('WARNING: Safe mode is on, shorten support disabled, md5data/sha1data for ogg vorbis disabled, ogg vorbos/flac tag writing disabled.');
}
// phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
if (($mbstring_func_overload = (int) ini_get('mbstring.func_overload')) && ($mbstring_func_overload & 0x02)) {
// http://php.net/manual/en/mbstring.overload.php
// "mbstring.func_overload in php.ini is a positive value that represents a combination of bitmasks specifying the categories of functions to be overloaded. It should be set to 1 to overload the mail() function. 2 for string functions, 4 for regular expression functions"
// getID3 cannot run when string functions are overloaded. It doesn't matter if mail() or ereg* functions are overloaded since getID3 does not use those.
// phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
$this->startup_error .= 'WARNING: php.ini contains "mbstring.func_overload = '.ini_get('mbstring.func_overload').'", getID3 cannot run with this setting (bitmask 2 (string functions) cannot be set). Recommended to disable entirely.'."\n";
}
@@ -442,15 +440,13 @@ class getID3
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
// Check for magic_quotes_runtime
if (function_exists('get_magic_quotes_runtime')) {
// phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_runtimeDeprecated
if (get_magic_quotes_runtime()) { // @phpstan-ignore-line
$this->startup_error .= 'magic_quotes_runtime must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_runtime(0) and set_magic_quotes_runtime(1).'."\n";
}
}
// Check for magic_quotes_gpc
if (function_exists('get_magic_quotes_gpc')) {
// phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_gpcDeprecated
if (get_magic_quotes_gpc()) { // @phpstan-ignore-line
if (get_magic_quotes_gpc()) {
$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";
}
}
@@ -485,7 +481,7 @@ class getID3
if (strpos($value, ' ') !== false) {
if (!empty($path_so_far)) {
$commandline = 'dir /x '.escapeshellarg(implode(DIRECTORY_SEPARATOR, $path_so_far));
$dir_listing = `$commandline`;
$dir_listing = shell_exec($commandline);
$lines = explode("\n", $dir_listing);
foreach ($lines as $line) {
$line = trim($line);
@@ -533,7 +529,7 @@ class getID3
* @return bool
*/
public function setOption($optArray) {
if (!is_array($optArray) || empty($optArray)) {
if (empty($optArray)) {
return false;
}
foreach ($optArray as $opt => $val) {
@@ -684,6 +680,8 @@ class getID3
catch (getid3_exception $e) {
throw $e;
}
} else {
$this->warning('skipping check for '.$tag_name.' tags since option_tag_'.$tag_name.'=FALSE');
}
}
if (isset($this->info['id3v2']['tag_offset_start'])) {
@@ -1481,6 +1479,16 @@ class getID3
// Misc other formats
// GPX - data - GPS Exchange Format
'gpx' => array (
'pattern' => '^<\\?xml [^>]+>[\s]*<gpx ',
'group' => 'misc',
'module' => 'gpx',
'mime_type' => 'application/gpx+xml',
'fail_id3' => 'ERROR',
'fail_ape' => 'ERROR',
),
// PAR2 - data - Parity Volume Set Specification 2.0
'par2' => array (
'pattern' => '^PAR2\\x00PKT',
@@ -1790,7 +1798,6 @@ class getID3
// page sequence numbers likely happens for OggSpeex and OggFLAC as well, but
// currently vorbiscomment only works on OggVorbis files.
// phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved
if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
$this->warning('Failed making system call to vorbiscomment.exe - '.$algorithm.'_data is incorrect - error returned: PHP running in Safe Mode (backtick operator not available)');
@@ -1814,7 +1821,7 @@ class getID3
if (file_exists(GETID3_HELPERAPPSDIR.'vorbiscomment.exe')) {
$commandline = '"'.GETID3_HELPERAPPSDIR.'vorbiscomment.exe" -w -c "'.$empty.'" "'.$file.'" "'.$temp.'"';
$VorbisCommentError = `$commandline`;
$VorbisCommentError = shell_exec($commandline);
} else {
@@ -1825,7 +1832,7 @@ class getID3
} else {
$commandline = 'vorbiscomment -w -c '.escapeshellarg($empty).' '.escapeshellarg($file).' '.escapeshellarg($temp).' 2>&1';
$VorbisCommentError = `$commandline`;
$VorbisCommentError = shell_exec($commandline);
}
@@ -1895,8 +1902,8 @@ class getID3
// Calculate combined bitrate - audio + video
$CombinedBitrate = 0;
$CombinedBitrate += (isset($this->info['audio']['bitrate']) ? $this->info['audio']['bitrate'] : 0);
$CombinedBitrate += (isset($this->info['video']['bitrate']) ? $this->info['video']['bitrate'] : 0);
$CombinedBitrate += (isset($this->info['audio']['bitrate']) && ($this->info['audio']['bitrate'] != 'free') ? $this->info['audio']['bitrate'] : 0);
$CombinedBitrate += (isset($this->info['video']['bitrate']) ? $this->info['video']['bitrate'] : 0);
if (($CombinedBitrate > 0) && empty($this->info['bitrate'])) {
$this->info['bitrate'] = $CombinedBitrate;
}
@@ -2003,7 +2010,9 @@ class getID3
if (empty($this->info['audio']['bitrate']) || empty($this->info['audio']['channels']) || empty($this->info['audio']['sample_rate']) || !is_numeric($this->info['audio']['sample_rate'])) {
return false;
}
$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));
if ($this->info['audio']['bitrate'] != 'free') {
$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));
}
if (!empty($this->info['audio']['streams'])) {
foreach ($this->info['audio']['streams'] as $streamnumber => $streamdata) {