php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48577 Exception in __destruct causes exception without a stack frame
Submitted: 2009-06-17 07:33 UTC Modified: 2009-06-18 14:17 UTC
From: php at benjaminschulz dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3.0RC3 OS: *
Private report: No CVE-ID: None
 [2009-06-17 07:33 UTC] php at benjaminschulz dot com
Description:
------------
If an exception is thrown from a __destruct in any object that has a 
cyclic references this results in an Exception without a stack frame.
This makes __destruct quiet unusable because this error is hard to debug 
large applications and cyclic references are quite common in OO.

Reproduce code:
---------------
$ php -r 'class foo { public function __destruct() { throw new Exception("bar"); }} $f = new foo; $f2 = new foo; $f->foo = $f2; $f2->foo = $f; '


Actual result:
--------------
PHP Fatal error:  Exception thrown without a stack frame in Unknown on 
line 0

Fatal error: Exception thrown without a stack frame in Unknown on line 0


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-18 14:17 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Our executor doesn't have a proper stack during shutdown. Until a larger refactoring is made this is expected.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC