Bug #79586 [NEW]: Destructor is not called again if the previous attempt kept the object alive
| From: | michael dot vorisek at email dot cz | Date: | Mon, 11 May 2020 11:32:52 +0000 |
| Subject: | Bug #79586 [NEW]: Destructor is not called again if the previous attempt kept the object alive | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-226993@lists.php.net to get a copy of this message | ||
From: michael dot vorisek at email dot cz
Operating system: any
PHP version: 7.4.5
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Destructor is not called again if the previous attempt kept the object alive
Description:
------------
Destructor has to be called on every attempt to release the object.
Test script:
---------------
class Registry {
public static $v;
}
$v = new class() extends \stdClass {
public function __destruct() {
var_dump($this);
Registry::$v = $this;
echo 'destroyed' . "\n";
}
};
unset($v);
var_dump(Registry::$v);
Registry::$v = null; // unset 2nd time
Expected result:
----------------
object(class@anonymous)#17 (0) {
}
destroyed
object(class@anonymous)#17 (0) {
}
object(class@anonymous)#17 (0) {
}
destroyed
Actual result:
--------------
object(class@anonymous)#17 (0) {
}
destroyed
object(class@anonymous)#17 (0) {
}
--
Edit bug report at https://bugs.php.net/bug.php?id=79586&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79586&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79586&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79586&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79586&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79586&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79586&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79586&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79586&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79586&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79586&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79586&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79586&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79586&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79586&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79586&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79586&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79586&r=mysqlcfg