PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Bug #191

study() is called too early, the file is not specified yet

Details

Submitted2003-11-04 14:26 UTC
Fromszathml at delfin dot klte dot hu
Assignedalexmerz
StatusClosed
PackageMP3_ID
PHP Version4.3.3
OSLinux, Windows
Roadmaps(Not assigned)

Comments

[2003-11-04 14:26 UTC] szathml at delfin dot klte dot hu

Description:
------------
I found a bug in MP3_Id.php in the PEAR repository. Even if I study a file, it doesn't work. I
found out why: in the example you write:

$id3 = &new MP3_Id();
$id3->read($file);

But you call the study() function from the constructor, but the file name
at that moment is unknown! So for example filesize cannot be
determined. My patch:

var $study = false;

function MP3_Id($study = false) {
if (defined('ID3_SHOW_DEBUG')) $this->debug = true;
$this->study = ($study || defined('ID3_AUTO_STUDY'));
}

function read($file) {
$this->file = $file; // it must be set before study()
if ($this->study) $this->study();

if ($this->debug) print($this->debugbeg . "id3('$file')<HR>\n");

if ($this->debug) print($this->debugend);

return $this->_read_v1();
}

I tried to contact the maintainer, but my mail bounced back.

[2004-01-15 16:36 UTC] alexmerz at php dot net

The bug is fixed in cvs, a new release will be avaible this evening