From: levi at alliancesoftware dot com dot au Operating system: PHP version: 5CVS-2006-01-11 (CVS) PHP Bug Type: Scripting Engine problem Bug description: Memory leak if exception thrown within switch
Description: ------------ A memory leak occurs if an exception is thrown within a switch($var) block The leak does not occur if the switch is made on a constant [eg switch(5)] Occurs in 5.0.5, but not in 5.1.1 It *does* however still appear in 5.0-CVS (2006-01-11) -- maybe the bug was 'accidentally' fixed in 5.1; I couldn't find any reference to it in the bugs list. If it was a deliberatel fix in 5.1, can the fix be backported to the 5.0 tree too? Reproduce code: --------------- #!/usr/local/src/php5/php-5.0CVS/php-src/sapi/cli/php <? try { $x = 0; switch ($x) { default: throw new Exception('bad thing happened'); } } catch (Exception $z) { } ?> Expected result: ---------------- Nothing Actual result: -------------- With --enable-debug: /usr/local/src/php5/php-5.0CVS/php-src/Zend/zend_execute.c(675) : Freeing 0x09A4C354 (16 byt es), script=./tX.php5 === Total 1 memory leaks detected === -- Edit bug report at http://bugs.php.net/?id=35968&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35968&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35968&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35968&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35968&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35968&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35968&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35968&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35968&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35968&r=support Expected behavior: http://bugs.php.net/fix.php?id=35968&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35968&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35968&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35968&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35968&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35968&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35968&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35968&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35968&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35968&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35968&r=mysqlcfg