Bug #72656 [Opn->Ver]: Object destructor called before constructor

From: Date: Mon, 25 Jul 2016 09:48:06 +0000
Subject: Bug #72656 [Opn->Ver]: Object destructor called before constructor
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202566@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72656&edit=1 ID: 72656 Updated by: cmb@php.net Reported by: joe88 dot ds at gmail dot com Summary: Object destructor called before constructor -Status: Open +Status: Verified Type: Bug Package: Scripting Engine problem Operating System: Windows 7 x64 PHP Version: 5.5.38 Block user comment: N Private report: N New Comment: There doesn't even need to be an error handler involved, see <https://3v4l.org/cR3nF>. Looking at the opcodes[1] hints at what's going on behind the scenes: first NEW is executed, and only after that the arguments for the constructor are evaluated, which, in this case, cause the script to terminate, without actually calling the constructor. On shutdown, however, the newly created object gets properly destroyed by calling its destructor. In my opinion, this is a bug. [1] <https://3v4l.org/cR3nF/vld#tabs> Previous Comments: ------------------------------------------------------------------------ [2016-07-23 05:29:10] joe88 dot ds at gmail dot com Description: ------------ Calling exit from a user error handler causes an object to be destructed, even if the object was never constructed. Test script: --------------- http://pastebin.com/UeBBj1hK Expected result: ---------------- The Tree's destructor should never be called. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72656&edit=1

« previous php.bugs (#202566) next »