#19269 [Com]: PEAR.php - memory eating bug

From: Date: Wed, 18 Sep 2002 16:52:55 +0000
Subject: #19269 [Com]: PEAR.php - memory eating bug
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-9173@lists.php.net to get a copy of this message
ID: 19269 Comment by: jrust@rustyparts.com Reported By: wolfram@kriesing.de Status: Feedback Bug Type: PEAR related Operating System: Any PHP Version: 4CVS-2002-09-06 New Comment: The problem with that solution is that if pushErrorHandling() has been called only once before popErrorHandling then after both array_pops are done there is nothing left in the stack to do list() on and thus the following error occurs: NOTICE (0x08) in /usr/share/php-pear/PEAR.php on line 492 Undefined offset: 0 Maybe the list() part should be done before the 2nd array_pop? Or is there a need for always putting both the default mode and the passed in mode onto the stack? Previous Comments: ------------------------------------------------------------------------ [2002-09-18 10:19:41] mj@php.net Could you please try if the following patch (untested) works for you? Index: PEAR.php =================================================================== RCS file: /repository/php4/pear/PEAR.php,v retrieving revision 1.47 diff -u -r1.47 PEAR.php --- PEAR.php 21 Jul 2002 07:04:45 -0000 1.47 +++ PEAR.php 18 Sep 2002 15:15:50 -0000 @@ -582,7 +582,8 @@ { $stack = &$GLOBALS['_PEAR_error_handler_stack']; array_pop($stack); - list($mode, $options) = $stack[sizeof($stack) - 1]; + array_pop($stack); + list($mode, $options) = $stack[sizeof($stack)]; if (isset($this)) { $this->setErrorHandling($mode, $options); } else { ------------------------------------------------------------------------ [2002-09-06 13:53:43] wolfram@kriesing.de i am working on a big import script and just for fun i checked the size of $GLOBALS on every turn, and i realized it grew constantly, i found out that pushErrorHandling pushes 2 elements on the array _PEAR_error_handler_stack, but popErrorHandling pop's only one off the array, so it grows on every use! and since those are used in DB/mysql.php and File/CSV.php my memory limit comes closer with every run through the while-loop ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19269&edit=1

« previous php.pear.dev (#9173) next »