Error in getID3() getID3-1.9.9-20141218

Locked
WaldoMonster
getID3() contributor
Posts:112
Joined:Mon Apr 01, 2002 12:20 am
Location:Netherlands
Contact:
Error in getID3() getID3-1.9.9-20141218

Post by WaldoMonster » Sat Dec 20, 2014 11:18 am

When updating a large music collection I get the following error:

Code: Select all

<br />
<b>Notice</b>:  Undefined offset: 1 in <b>/data/Internet/live.netjukebox.nl/getid3/getid3/getid3.lib.php</b> on line <b>1169</b><br />
With the same music collection and getID3 1.9.8 I didn't get this error message.

At the moment I can't say witch file caused this error.
The music collection only contains flac, mp3 and mpc files.

James Heinrich
getID3() v1 developer
Posts:1477
Joined:Fri May 04, 2001 4:00 pm
Are you a spambot?:no
Location:Northern Ontario, Canada
Contact:

Re: Error in getID3() getID3-1.9.9-20141218

Post by James Heinrich » Sat Dec 20, 2014 1:24 pm

It's something where getimagesize is failing on an embedded image, for some reason. If you can isolate which sample file is causing it that'd be great.

In any case this commit should avoid trying to use array keys that don't exist:
https://github.com/JamesHeinrich/getID3 ... 667e0ed331

WaldoMonster
getID3() contributor
Posts:112
Joined:Mon Apr 01, 2002 12:20 am
Location:Netherlands
Contact:

Re: Error in getID3() getID3-1.9.9-20141218

Post by WaldoMonster » Sat Dec 20, 2014 10:33 pm

I found 10 flac files witch produces the above error.
I will send a link to one of them by private message.

WaldoMonster
getID3() contributor
Posts:112
Joined:Mon Apr 01, 2002 12:20 am
Location:Netherlands
Contact:

Re: Error in getID3() getID3-1.9.9-20141218

Post by WaldoMonster » Sat Dec 20, 2014 10:53 pm

The error also happens when option_save_attachments is set to false, see code below.

Code: Select all

<?php
require_once('include/initialize.inc.php');
require_once('getid3/getid3/getid3.php');
fileInfo();


//  +------------------------------------------------------------------------+
//  | File info                                                              |
//  +------------------------------------------------------------------------+
function fileInfo() {
	global $cfg, $db;
	
	// Initialize getID3
	$getID3 = new getID3;
	// public: Settings
	$getID3->encoding        			= $cfg['default_charset'];	// CASE SENSITIVE! - i.e. (must be supported by iconv()) Examples:  ISO-8859-1  UTF-8  UTF-16  UTF-16BE
	$getID3->encoding_id3v1  			= 'ISO-8859-1';				// Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN'
	// public: Optional tag checks - disable for speed.
	$getID3->option_tag_id3v1			= false;		// Read and process ID3v1 tags
	$getID3->option_tag_id3v2			= false;		// Read and process ID3v2 tags
	$getID3->option_tag_lyrics3			= false;		// Read and process Lyrics3 tags
	$getID3->option_tag_apetag			= false;		// Read and process APE tags
	$getID3->option_tags_process		= false;		// Copy tags to root key 'tags' and encode to $this->encoding
	$getID3->option_tags_html			= false;		// Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities
	// public: Optional tag/comment calucations
	$getID3->option_extra_info			= true;			// Calculate additional info such as bitrate, channelmode etc
	// public: Optional handling of embedded attachments (e.g. images)
	$getID3->option_save_attachments	= false;			// defaults to true (ATTACHMENTS_INLINE) for backward compatibility
	// public: Optional calculations
	$getID3->option_md5_data			= false;		// Get MD5 sum of data part - slow
	$getID3->option_md5_data_source		= false;		// Use MD5 of source file if availble - only FLAC and OptimFROG
	$getID3->option_sha1_data			= false;		// Get SHA1 sum of data part - slow
	$getID3->option_max_2gb_check		= null;			// Check whether file is larger than 2 Gb and thus not supported by PHP
	
	$query = mysqli_query($db, 'SELECT relative_file, filesize, filemtime, album_id FROM track WHERE NOT updated ORDER BY relative_file');
	while ($track = mysqli_fetch_assoc($query)) {
		$file = $cfg['media_dir'] . $track['relative_file'];
		
		echo html($file) . '<br>';
		$getID3->analyze($file);
	}
	// Close getID3				
	unset($getID3);
}

James Heinrich
getID3() v1 developer
Posts:1477
Joined:Fri May 04, 2001 4:00 pm
Are you a spambot?:no
Location:Northern Ontario, Canada
Contact:

Re: Error in getID3() getID3-1.9.9-20141218

Post by James Heinrich » Sun Dec 21, 2014 12:57 am

Your sample file now (with the changes from my first post above) correctly returns "COVERART vorbiscomment tag contains invalid image" in [warning] rather than producing a PHP error.

WaldoMonster
getID3() contributor
Posts:112
Joined:Mon Apr 01, 2002 12:20 am
Location:Netherlands
Contact:

Re: Error in getID3() getID3-1.9.9-20141218

Post by WaldoMonster » Sun Dec 21, 2014 10:15 am

James Heinrich wrote:Your sample file now (with the changes from my first post above) correctly returns "COVERART vorbiscomment tag contains invalid image" in [warning] rather than producing a PHP error.
Thanks very much for the fast update!
I think this topic can be closed ;-)

Locked