From: cunha17 at uol dot com dot br
Operating system: RedHat Linux 9.0
PHP version: 5CVS-2003-08-31 (dev)
PHP Bug Type: Zend Engine 2 problem
Bug description: Memory Leak with error handler and exceptions
Description:
------------
This code below gives some memory leak. The leak only appears when
throwing exceptions inside error handler.
The code I'm using is a little more complex 'cause it translates PHP
errors into PHP Exceptions, but this piece of code reproduces the leak
correctly.
Reproduce code:
---------------
<?
function my_error($nr, $text, $file, $line, $vars)
{
throw new Exception($text);
}
error_reporting(E_ALL);
set_error_handler("my_error");
try {
include("unexistent");
} catch (Exception $e) {
echo "EXCEPTION!!!";
}
?>
Expected result:
----------------
EXCEPTION!!!
Actual result:
--------------
EXCEPTION!!!/usr/src/zend2/php-src/Zend/zend.c(914) : Freeing 0x404C9340
(16 bytes), script=leak.php
=== Total 1 memory leaks detected ===
--
Edit bug report at http://bugs.php.net/?id=25335&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25335&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25335&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25335&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25335&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25335&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25335&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25335&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25335&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25335&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25335&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25335&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25335&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25335&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25335&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25335&r=gnused