Bug #79857 [NEW]: destructor no longer called when constructor exits

From: Date: Tue, 14 Jul 2020 10:54:40 +0000
Subject: Bug #79857 [NEW]: destructor no longer called when constructor exits
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228034@lists.php.net to get a copy of this message
From:             sjon
Operating system: archLinux
PHP version:      8.0.0alpha2
Package:          Class/Object related
Bug Type:         Bug
Bug description:destructor no longer called when constructor exits

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 bug report at https://bugs.php.net/bug.php?id=79857&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=79857&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=79857&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=79857&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=79857&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=79857&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=79857&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=79857&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=79857&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=79857&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=79857&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79857&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=79857&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=79857&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=79857&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=79857&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=79857&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=79857&r=mysqlcfg


Thread (2 messages)

« previous php.bugs (#228034) next »