Found a bug... {Notice: Uninitialized string offset: 6}

Locked
dearth
User
Posts:2
Joined:Tue Jan 11, 2011 10:32 pm
Are you a spambot?:no
Found a bug... {Notice: Uninitialized string offset: 6}

Post by dearth » Tue Jan 11, 2011 10:42 pm

Hey all. building a project that uses this wonderful library.

However, i found a bit of a bug (that doesn't turn up when i search the forums/ google....)

Code: Select all


Uninitialized string offset: 6 in /var/www/<not needed>/module.tag.id3v2.php on line 1855 Notice: Uninitialized string offset: 6 in /var/www/<not needed>/module.tag.id3v2.php on line 1859 


Just wanted to let you know that i seem to get a valid array back. It does not matter what mp3 file i feed it, and here are the initialization settings:

Code: Select all

		// make the id3 object and set it's options up correctly
		$this->id3 = new getID3;
		$this->id3->encoding ='UTF-8';
		$this->id3->encoding_id3v2 = 'UTF-8';
		$this->id3->option_tag_id3v1 = FALSE;
		$this->id3->option_tag_id3v2 = TRUE;
		$this->id3->option_tag_lyrics3 = FALSE;
		$this->id3->option_tag_apetag = TRUE;
		$this->id3->option_accurate_results = FALSE;
		$this->id3->option_tags_images = TRUE;

i'll be looking into this as i get time.

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: Found a bug... {Notice: Uninitialized string offset: 6}

Post by James Heinrich » Thu Jan 13, 2011 2:17 pm

What version of getID3 and PHP are you using?

It appears to be in the ReplayGain code where the 'signbit' key is being set (in two places) by accessing the 7th character directly using square-bracket notation. These 3 lines should behave identically, but apparently your version of PHP doesn't like the square-bracket style (you can test the curly-brace variant if you're curious):

Code: Select all

substr($rg_track_adjustment, 6, 1)
$rg_track_adjustment[6]
$rg_track_adjustment{6}
I've changed to the more-standard substr() style for those two lines for v2.0.0b7:

Code: Select all

$parsed_frame['raw']['track']['signbit']    = bindec(substr($rg_track_adjustment, 6, 1));
$parsed_frame['raw']['album']['signbit']    = bindec(substr($rg_album_adjustment, 6, 1));

dearth
User
Posts:2
Joined:Tue Jan 11, 2011 10:32 pm
Are you a spambot?:no

Re: Found a bug... {Notice: Uninitialized string offset: 6}

Post by dearth » Thu Jan 13, 2011 6:59 pm

Im running getid3-2.0.0b6-20101125 on a ubuntu box running 2.6.32-27-generic-pae with this php build: PHP 5.3.2-1ubuntu4.7 with Suhosin-Patch (cli) (built: Jan 12 2011 18:36:08)

Locked