PEAR is archived and read-only

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

Home » Mail » Mail_Mbox » Bug #2930

size() function triggers error, and kills script

Details

Submitted2004-12-08 23:15 UTC
Fromtomsommer at php dot net
Assigneddarkelder
StatusClosed
PackageMail_Mbox
PHP Version4.3.9
Roadmaps(Not assigned)

Comments

[2004-12-08 23:15 UTC] tomsommer at php dot net

Description:
------------
After installing 0.3 I get this error sometimes:

PHP Warning: array_key_exists(): The second argument should be either an array or an object in /usr/local/lib/php/Mail/mbox.php on l
ine 241
PHP Fatal error: Cannot instantiate non-existent class: object in /usr/local/lib/php/PEAR.php on line 539

It seems the new _process function can leave $this->_resources[$resourceId]["messages"] as null (not defined) and so array_key_exists triggers an error in the $this->size() function

The PEAR.php error seems to be related to the error handler, which cannot be initiated and so the script dies.

I cannot say if the two are related, but they happen in the same second (according to my error_log).

My PEAR errorHandler is set to PEAR_ERROR_TRIGGER

[2004-12-09 22:42 UTC] tomsommer at php dot net

Your commit does not look correct:

http://cvs.php.net/diff.php/pear/Mail_Mbox/mbox.php?ws=0&r1=1.13&r2=1.14&ty=u

the is_array() will, in your case, check a boolean - since you close the function too late.