Bug #81126 [Opn->Nab]: Destructor is invoked even if invoked manually already
| From: | nikic@php.net | Date: | Thu, 10 Jun 2021 20:50:25 +0000 |
| Subject: | Bug #81126 [Opn->Nab]: Destructor is invoked even if invoked manually already | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-234362@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81126&edit=1
ID: 81126
Updated by: nikic@php.net
Reported by: m at m dot cz
Summary: Destructor is invoked even if invoked manually
already
-Status: Open
+Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: any
PHP Version: 8.0.7
Block user comment: N
Private report: N
New Comment:
The behavior is correct.
Previous Comments:
------------------------------------------------------------------------
[2021-06-10 19:51:55] m at m dot cz
Description:
------------
see https://3v4l.org/AjLjK
Test script:
---------------
<?php
$a = new class {
public function __destruct() {
echo '__destruct called' . "\n";
}
};
$a->__destruct();
$a = null;
Expected result:
----------------
__destruct called
and maybe some warning as __destruct should not be called manually
Actual result:
--------------
__destruct called
__destruct called
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81126&edit=1