ID: 37891
Updated by: [EMAIL PROTECTED]
Reported By: hannes dot magnusson at gmail dot com
-Status: Assigned
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: FreeBSD
PHP Version: 5CVS-2006-06-22 (CVS)
Assigned To: dmitry
New Comment:
This code creates circular data structure. PHP doesn't free circular
data structures at run-time and does free them on request shutdown
(with warning about memory leak).
php-5.1 didn't store "$this object" in backtrace, so it didn't create
circular data structure and worked fine.
Previous Comments:
------------------------------------------------------------------------
[2006-06-22 18:20:03] hannes dot magnusson at gmail dot com
Description:
------------
Can't seem to get the example any shorter...
Reproduce code:
---------------
<?php
class foo {
public $arr = array();
function foo(){
$this->backtrace = debug_backtrace();
call_user_func(array($this, "bar"));
}
function bar() {
array_unshift($this->arr, debug_backtrace());
}
}
$foo = &new foo;
?>
Actual result:
--------------
/usr/src/clean/php5/Zend/zend_execute.c(403) : Freeing
0x082F48E4 (16 bytes), script=/usr/local/php5/....
=== Total 1 memory leaks detected ===
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37891&edit=1