#34065 [Asn->Csd]: throw in foreach causes memory leaks

From: Date: Tue, 19 Sep 2006 21:44:35 +0000
Subject: #34065 [Asn->Csd]: throw in foreach causes memory leaks
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-102452@lists.php.net to get a copy of this message
ID: 34065 Updated by: dmitry@php.net Reported By: dmitry@php.net -Status: Assigned +Status: Closed Bug Type: Scripting Engine problem Operating System: * PHP Version: 6CVS, 5CVS (2005-08-23) Assigned To: dmitry New Comment: Fixed in CVS HEAD and PHP_5_2. Previous Comments: ------------------------------------------------------------------------ [2006-08-28 09:20:40] dmitry@php.net See also bug #38623 ------------------------------------------------------------------------ [2005-08-10 12:06:16] dmitry@php.net Description: ------------ Throwing exception from inside a foreach block can produce memory leaks, because ZEND_SWITCH_FREE opcode is not executed. Reproduce code: --------------- <?php $data = file(__FILE__); try { foreach ($data as $line) { throw new Exception("error"); } } catch (Exception $e) { echo "ok\n"; } ?> Expected result: ---------------- ok Actual result: -------------- memory leaks ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34065&edit=1

« previous php.bugs (#102452) next »