php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38234 Exception in __clone makes memory leak
Submitted: 2006-07-27 10:25 UTC Modified: 2006-07-27 10:45 UTC
From: dmitry@php.net Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2006-07-27 (CVS) OS: *
Private report: No CVE-ID: None
 [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 ===


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-27 10:45 UTC] dmitry@php.net
Fixed in CVS HEAD and PHP_5_2.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 07:01:29 2024 UTC