Skip to content

Commit 35bda64

Browse files
committed
PHP8.5 compatibility
#477
1 parent 4a09bdb commit 35bda64

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

getid3/getid3.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ class getID3
387387
*/
388388
protected $startup_warning = '';
389389

390-
const VERSION = '1.9.24-202512160912';
390+
const VERSION = '1.9.24-202512161137';
391391
const FREAD_BUFFER_SIZE = 32768;
392392

393393
const ATTACHMENTS_NONE = false;

getid3/module.audio-video.quicktime.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3098,11 +3098,13 @@ public function Pascal2String($pascalstring) {
30983098
public function MaybePascal2String($pascalstring) {
30993099
// Pascal strings have 1 unsigned byte at the beginning saying how many chars (1-255) are in the string
31003100
// Check if string actually is in this format or written incorrectly, straight string, or null-terminated string
3101-
if (ord(substr($pascalstring, 0, 1)) == (strlen($pascalstring) - 1)) {
3102-
return substr($pascalstring, 1);
3103-
} elseif (substr($pascalstring, -1, 1) == "\x00") {
3104-
// appears to be null-terminated instead of Pascal-style
3105-
return substr($pascalstring, 0, -1);
3101+
if (strlen($pascalstring) > 0) {
3102+
if (ord(substr($pascalstring, 0, 1)) == (strlen($pascalstring) - 1)) {
3103+
return substr($pascalstring, 1);
3104+
} elseif (substr($pascalstring, -1, 1) == "\x00") {
3105+
// appears to be null-terminated instead of Pascal-style
3106+
return substr($pascalstring, 0, -1);
3107+
}
31063108
}
31073109
return $pascalstring;
31083110
}

getid3/module.audio.mp3.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ public function RecursiveFrameScanning(&$offset, &$nextframetestoffset, $ScanAsC
11781178

11791179
$nextframetestarray = array('error' => array(), 'warning' => array(), 'avdataend' => $info['avdataend'], 'avdataoffset'=>$info['avdataoffset']);
11801180
if ($this->decodeMPEGaudioHeader($nextframetestoffset, $nextframetestarray, false)) {
1181-
getid3_lib::safe_inc($info['mp3_validity_check_bitrates'][$nextframetestarray['mpeg']['audio']['bitrate']]);
1181+
getid3_lib::safe_inc($info['mp3_validity_check_bitrates'][intval($nextframetestarray['mpeg']['audio']['bitrate'])]);
11821182
if ($ScanAsCBR) {
11831183
// force CBR mode, used for trying to pick out invalid audio streams with valid(?) VBR headers, or VBR streams with no VBR header
11841184
if (!isset($nextframetestarray['mpeg']['audio']['bitrate']) || !isset($firstframetestarray['mpeg']['audio']['bitrate']) || ($nextframetestarray['mpeg']['audio']['bitrate'] != $firstframetestarray['mpeg']['audio']['bitrate'])) {

0 commit comments

Comments
 (0)