Bug #79857 [Opn->Csd]: destructor no longer called when constructor exits
Edit report at https://bugs.php.net/bug.php?id=79857&edit=1
ID: 79857
Updated by: nikic@php.net
Reported by: sjon@php.net
Summary: destructor no longer called when constructor exits
-Status: Open
+Status: Closed
Type: Bug
Package: Class/Object related
Operating System: archLinux
PHP Version: 8.0.0alpha2
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e3827cea4e5c41db1e45b4a47ca136d008974e16
Log: Fix bug #79857: Add upgrading note for exit dtor change
Previous Comments:
------------------------------------------------------------------------
[2020-07-14 10:54:40] sjon@php.net
Description:
------------
Not sure if this is intentional or not but it isn't documented. It might cause unexpected
issues for people expecting the destructor to always be executed
originally found as https://3v4l.org/imPGg
Test script:
---------------
class cm404 {
function __construct() {
exit("construct\n");
}
function __destruct() {
exit("destruct\n");
}
}
new cm404();
Expected result:
----------------
construct
destruct
Actual result:
--------------
construct
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79857&edit=1
Thread (2 messages)