Req #51001 [Com]: Always shows stack trace when a Fatal error occurs
Edit report at https://bugs.php.net/bug.php?id=51001&edit=1 ID: 51001 Comment by: anrdaemon at freemail dot ru Reported by:abdallah at gmx dot com Summary:Always shows stack trace when a Fatal error occurs Status: Feedback Type: Feature/Change Request Package:Scripting Engine problem Operating System: Windows 7 PHP Version:5.3.1 Block user comment: N Private report: N New Comment: I'm facing a problem in tracking down various issues in a complex project, and I would greatly benefit from ability to call Exception::getTraceAsString() statically. So that instead of doing something like default: if(isset($GLOBALS['toolDebugfilterEnabled']) && $GLOBALS['toolDebugfilterEnabled'] === true) { print('Breakpoint reached in: '); $e = new Exception($mode); print($e->getTraceAsString()); I could just do a default: if(isset($GLOBALS['toolDebugfilterEnabled']) && $GLOBALS['toolDebugfilterEnabled'] === true) { print('Breakpoint reached in: '); print(Exception::getTraceAsString()); and be done with it. Previous Comments: [2011-04-12 20:40:30] dharkness at gmail dot com You actually have to remove the try/catch to reproduce the problem. When you catch the exception, no fatal error is raised and you can see the stack trace. If you don't catch the exception, the PHP engine raises an E_FATAL error which cannot be trapped. We use a shutdown hook and check for fatal errors so we can report the issue, but at that point there's no stack trace--just the file and line where the error occurred. It would be nice to have a similar function to error_get_last() to get the stack trace, such as backtrace_get_last(). [2010-11-24 09:44:26] j...@php.net I do get a trace here using your reproduce script with PHP 5.3.4RC1. So what is the problem? [2010-04-10 01:51:31] a at b dot c dot de An observation from me: A stack trace is dumped in the event of a fatal error (depending on the error reporting level); but it's only when an uncaught exception reaches the top of the call stack without being handled that such an error occurs. If it is caught, then it's not an uncaught exception and therefore not a Fatal error. [2010-02-10 20:05:24] abdallah at gmx dot com Description: Always shows stack trace when a Fatal error occurs without having to do always something like this : getTraceAsString(); } ?> Reproduce code: --- getTraceAsString(); } ?> Expected result: #0 /home/bjori/tmp/ex.php(7): test() #1 {main} Actual result: -- nothin' -- Edit this bug report at https://bugs.php.net/bug.php?id=51001&edit=1
Req #51001 [Com]: Always shows stack trace when a Fatal error occurs
Edit report at http://bugs.php.net/bug.php?id=51001&edit=1 ID: 51001 Comment by: dharkness at gmail dot com Reported by:abdallah at gmx dot com Summary:Always shows stack trace when a Fatal error occurs Status: Feedback Type: Feature/Change Request Package:Scripting Engine problem Operating System: Windows 7 PHP Version:5.3.1 Block user comment: N Private report: N New Comment: You actually have to remove the try/catch to reproduce the problem. When you catch the exception, no fatal error is raised and you can see the stack trace. If you don't catch the exception, the PHP engine raises an E_FATAL error which cannot be trapped. We use a shutdown hook and check for fatal errors so we can report the issue, but at that point there's no stack trace--just the file and line where the error occurred. It would be nice to have a similar function to error_get_last() to get the stack trace, such as backtrace_get_last(). Previous Comments: [2010-11-24 09:44:26] j...@php.net I do get a trace here using your reproduce script with PHP 5.3.4RC1. So what is the problem? [2010-04-10 01:51:31] a at b dot c dot de An observation from me: A stack trace is dumped in the event of a fatal error (depending on the error reporting level); but it's only when an uncaught exception reaches the top of the call stack without being handled that such an error occurs. If it is caught, then it's not an uncaught exception and therefore not a Fatal error. [2010-02-10 20:05:24] abdallah at gmx dot com Description: Always shows stack trace when a Fatal error occurs without having to do always something like this : getTraceAsString(); } ?> Reproduce code: --- getTraceAsString(); } ?> Expected result: #0 /home/bjori/tmp/ex.php(7): test() #1 {main} Actual result: -- nothin' -- Edit this bug report at http://bugs.php.net/bug.php?id=51001&edit=1
Req #51001 [Com]: Always shows stack trace when a Fatal error occurs
Edit report at http://bugs.php.net/bug.php?id=51001&edit=1 ID: 51001 Comment by: a at b dot c dot de Reported by: abdallah at gmx dot com Summary: Always shows stack trace when a Fatal error occurs Status: Open Type: Feature/Change Request Package: Feature/Change Request Operating System: Windows 7 PHP Version: 5.3.1 New Comment: An observation from me: A stack trace is dumped in the event of a fatal error (depending on the error reporting level); but it's only when an uncaught exception reaches the top of the call stack without being handled that such an error occurs. If it is caught, then it's not an uncaught exception and therefore not a Fatal error. Previous Comments: [2010-02-10 20:05:24] abdallah at gmx dot com Description: Always shows stack trace when a Fatal error occurs without having to do always something like this : getTraceAsString(); } ?> Reproduce code: --- getTraceAsString(); } ?> Expected result: #0 /home/bjori/tmp/ex.php(7): test() #1 {main} Actual result: -- nothin' -- Edit this bug report at http://bugs.php.net/bug.php?id=51001&edit=1