Bug #79885 [Opn->Wfx]: Backtrace behaviour seems wrong/changed

From: Date: Wed, 22 Jul 2020 14:54:59 +0000
Subject: Bug #79885 [Opn->Wfx]: Backtrace behaviour seems wrong/changed
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228180@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79885&edit=1 ID: 79885 Updated by: nikic@php.net Reported by: kenashkov at gmail dot com Summary: Backtrace behaviour seems wrong/changed -Status: Open +Status: Wont fix Type: Bug Package: Scripting Engine problem Operating System: Debian 9 4.15.0-91-generic PHP Version: 7.4.8 Block user comment: N Private report: N New Comment: This is an intentional change, specifically to prevent access to partially destroyed local variables from a destructor backtrace. Local variables are now destroyed after switching to the parent frame, which ensures that they cannot be observed in a partially destroyed state. Previous Comments: ------------------------------------------------------------------------ [2020-07-22 14:48:20] kenashkov at gmail dot com Description: ------------ The backtrace generate at object __destruct() seems has changed. PHP 7.2.24 returns the expected result, while on PHP 7.4.8 a stack frame is missing. Test script: --------------- <?php class ref { public function __destruct() { debug_print_backtrace(); print 'destr'; } } function f1() { try { f2(); } catch (\Exception $E) { } } function f2() { $o = new ref; throw new \Exception('ex'); } f1(); Expected result: ---------------- #0 ref->__destruct() called at [/t1.php:22] #1 f2() called at [/t1.php:13] #2 f1() called at [/t1.php:25] Actual result: -------------- #0 ref->__destruct() called at [/t1.php:13] #1 f1() called at [/t1.php:25] ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79885&edit=1

« previous php.bugs (#228180) next »