Exception in __clone makes memory leak
[2006-07-27 10:25 UTC] dmitry@php.net
Description:
------------
PHP makes a memory leak in case if script throws exception from inside __clone() method.
Reproduce code:
---------------
<?php
class Foo {
function __clone() {
throw new Exception();
}
}
try {
$x = new Foo();
$y = clone $x;
} catch (Exception $e) {
}
echo "ok\n";
?>
Expected result:
----------------
ok
Actual result:
--------------
ok
[Thu Jul 27 14:21:47 2006] Script: 'x.php'
/home/dmitry/php/php5.2/Zend/zend_vm_execute.h(19949) : Freeing 0xB7ECBFF8 (16 bytes), script=x.php
=== Total 1 memory leaks detected ===