Bug #71366 [Opn]: When use anonymous function in class property have a memory leak
| From: | xiemaomao520 at 163 dot com | Date: | Thu, 14 Jan 2016 09:24:50 +0000 |
| Subject: | Bug #71366 [Opn]: When use anonymous function in class property have a memory leak | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-198643@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71366&edit=1
ID: 71366
User updated by: xiemaomao520 at 163 dot com
Reported by: xiemaomao520 at 163 dot com
-Summary: When use anonymous function in class property has
leak memory
+Summary: When use anonymous function in class property have a
memory leak
Status: Open
Type: Bug
Package: PDO Core
Operating System: All
PHP Version: 7.0.2
Block user comment: N
Private report: N
New Comment:
Change title.
Previous Comments:
------------------------------------------------------------------------
[2016-01-14 09:22:08] xiemaomao520 at 163 dot com
Description:
------------
Affect all PHP versions.
Test script:
---------------
<?php
class A {
public function __construct ()
{
$this->call = function () {
};
}
public function __destruct()
{
echo 'Destruct: ' . get_class($this) . PHP_EOL;
}
}
class B
{
public function __destruct()
{
echo 'Destruct: ' . get_class($this) . PHP_EOL;
}
}
function test()
{
new A;
new B;
}
test();
echo "Exit\n";
Expected result:
----------------
Destruct: A
Destruct: B
Exit
Actual result:
--------------
Destruct: B
Exit
Destruct: A
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71366&edit=1