|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2010-02-10 20:05 UTC] abdallah at gmx dot com
 Description:
------------
Always shows stack trace when a Fatal error occurs without having to do always something like this :
<?php
function test() {
    throw new Exception;
}
try {
    test();
} catch(Exception $e) {
    echo $e->getTraceAsString();
}
?>
Reproduce code:
---------------
<?php
function test() {
    throw new Exception;
}
try {
    test();
} catch(Exception $e) {
    echo $e->getTraceAsString();
}
?>
Expected result:
----------------
#0 /home/bjori/tmp/ex.php(7): test()
#1 {main}
Actual result:
--------------
nothin'
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 02:00:02 2025 UTC | 
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.