wiztrust / php-reader

Automatically exported from code.google.com/p/php-reader
0 stars 0 forks source link

Fatal error in MPEG_ABS #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
CODE:

<?php

$mp3 = new MPEG_ABS('/home/paulo/Music/sample.mp3');

?>

ERRORS:

Notice:  Undefined offset: 0 in
/opt/lampp/htdocs/libs/php-reader/lib/MPEG/ABS/Frame.php on line 265

Notice:  Undefined offset: 0 in
/opt/lampp/htdocs/libs/php-reader/lib/MPEG/ABS/Frame.php on line 267

Notice:  Undefined offset: 0 in
/opt/lampp/htdocs/libs/php-reader/lib/MPEG/ABS/Frame.php on line 268

Fatal error:  Uncaught exception 'Reader_Exception' with message 'Invalid
argument' in /opt/lampp/htdocs/libs/php-reader/lib/Reader.php:113
Stack trace:
#0 /opt/lampp/htdocs/libs/php-reader/lib/MPEG/ABS/Frame.php(274):
Reader->skip(-4)
#1 /opt/lampp/htdocs/libs/php-reader/lib/MPEG/ABS.php(159):
MPEG_ABS_Frame->__construct(Object(Reader), Array)
#2 /opt/lampp/htdocs/music/controller.php(23):
MPEG_ABS->__construct('/home/paulo/Mus...')
#3 /opt/lampp/htdocs/music/controller.php(72):
MediaInfo->__construct('/home/paulo/Mus...')
#4 {main}
  thrown in /opt/lampp/htdocs/libs/php-reader/lib/Reader.php on line 113

Original issue reported on code.google.com by v1d4l...@gmail.com on 6 Feb 2010 at 8:38

GoogleCodeExporter commented 9 years ago
Please include your sample file as well

Original comment by svollbehr on 14 Feb 2010 at 8:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Oh, sorry! I didn't know that it was necessary.

My "sample" file is a song protected by copyright, and thus I can't post here. I
could send to your e-mail, it's Ok for you?

Regards,

Original comment by v1d4l...@gmail.com on 15 Feb 2010 at 6:57

GoogleCodeExporter commented 9 years ago
Please do so

Original comment by svollbehr on 16 Feb 2010 at 1:30

GoogleCodeExporter commented 9 years ago
I still need the sample file for this. Please send it to me so I can debug the 
issue
with it.

Original comment by svollbehr on 7 Mar 2010 at 8:56

GoogleCodeExporter commented 9 years ago
Closed until problem can be reproduced

Original comment by svollbehr on 26 Mar 2010 at 6:51

GoogleCodeExporter commented 9 years ago
I'm having the same problem as posted.  I'm attaching the MP3 that is giving me 
issues (though it's by far not 
the only one).

The PHP code I'm using is:

require_once 'Zend/Media/Mpeg/Abs.php'; // or using autoload
$abs = new Zend_Media_Mpeg_Abs('00.mp3'); 

The output I get is:

PHP Notice:  Undefined offset:  0 in 
/home/glandix/include/Zend/Media/Mpeg/Abs/Frame.php on line 254

Notice: Undefined offset:  0 in 
/home/glandix/include/Zend/Media/Mpeg/Abs/Frame.php on line 254
PHP Warning:  Division by zero in 
/home/glandix/include/Zend/Media/Mpeg/Abs/Frame.php on line 255

Warning: Division by zero in 
/home/glandix/include/Zend/Media/Mpeg/Abs/Frame.php on line 255
PHP Notice:  Undefined offset:  0 in 
/home/glandix/include/Zend/Media/Mpeg/Abs/Frame.php on line 256

Notice: Undefined offset:  0 in 
/home/glandix/include/Zend/Media/Mpeg/Abs/Frame.php on line 256
PHP Notice:  Undefined offset:  0 in 
/home/glandix/include/Zend/Media/Mpeg/Abs/Frame.php on line 257

Notice: Undefined offset:  0 in 
/home/glandix/include/Zend/Media/Mpeg/Abs/Frame.php on line 257
PHP Fatal error:  Uncaught exception 'Zend_Io_Exception' with message 'Size 
cannot be negative' in 
/home/glandix/include/Zend/Io/Reader.php:168
Stack trace:
#0 /home/glandix/include/Zend/Media/Mpeg/Abs/Frame.php(263): 
Zend_Io_Reader->skip(-4)
#1 /home/glandix/include/Zend/Media/Mpeg/Abs.php(408): 
Zend_Media_Mpeg_Abs_Frame-
>__construct(Object(Zend_Io_FileReader), Array)
#2 /home/glandix/include/Zend/Media/Mpeg/Abs.php(218): 
Zend_Media_Mpeg_Abs->_readFrames(1000)
#3 /home/glandix/aac.php(16): Zend_Media_Mpeg_Abs->__construct('00.mp3')
#4 {main}
  thrown in /home/glandix/include/Zend/Io/Reader.php on line 168

Fatal error: Uncaught exception 'Zend_Io_Exception' with message 'Size cannot 
be negative' in 
/home/glandix/include/Zend/Io/Reader.php:168
Stack trace:
#0 /home/glandix/include/Zend/Media/Mpeg/Abs/Frame.php(263): 
Zend_Io_Reader->skip(-4)
#1 /home/glandix/include/Zend/Media/Mpeg/Abs.php(408): 
Zend_Media_Mpeg_Abs_Frame-
>__construct(Object(Zend_Io_FileReader), Array)
#2 /home/glandix/include/Zend/Media/Mpeg/Abs.php(218): 
Zend_Media_Mpeg_Abs->_readFrames(1000)
#3 /home/glandix/aac.php(16): Zend_Media_Mpeg_Abs->__construct('00.mp3')
#4 {main}
  thrown in /home/glandix/include/Zend/Io/Reader.php on line 168

Original comment by glan...@gmail.com on 24 May 2010 at 6:36

Attachments:

GoogleCodeExporter commented 9 years ago
Also, after I had the issue above, I added the following code on line 236 of 
Zend/Media/Mpeg/Abs/Frame.php:

print 'LAYER: ' . $this->_layer . "\n";

I get the following output with the above file:

LAYER: 2
LAYER: 2
LAYER: 2
LAYER: 1
LAYER: 2
LAYER: 0

Followed by the PHP errors mentioned in my previous post

Original comment by glan...@gmail.com on 24 May 2010 at 6:40

GoogleCodeExporter commented 9 years ago
Thanks for reporting! I will investigate the issue the soonest!

Original comment by svollbehr on 24 May 2010 at 7:01

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Quick look with a hex editor at the source file reveals that your MP3 file 
actually
has two ID3v2 tags, one after the other.

The Zend_Media_Mpeg_Abs class successfully skips both ID3v1 and ID3v2 tags 
found from
both ends of the file but does not have any logic for the second ID3v2 tag. 
Thus the
class starts parsing MPEG data where the second ID3v2 tag starts thinking it's 
the
beginning of the MPEG stream (as it should start there). This is also the root 
cause
of the invalid values in the parsing. 

I manually removed the first ID3v2 tag from the file and the class was able to
extract the file information after that. I will add a code snippet to the ID3v2 
wiki
page on how to remove tags from the files.

Original comment by svollbehr on 24 May 2010 at 7:48