Last active
August 29, 2015 14:22
-
-
Save evaisse/302b21637957a64155d5 to your computer and use it in GitHub Desktop.
fatal with to without trace ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function will_fatal() | |
{ | |
a(); | |
} | |
function a() | |
{ | |
b(); | |
} | |
function b() | |
{ | |
c(); | |
} | |
function c() | |
{ | |
debug_print_backtrace(); // Here everything ok | |
/* | |
#0 c() called at [/test.php:16] | |
#1 b() called at [/test.php:11] | |
#2 a() called at [/test.php:6] | |
#3 will_fatal() called at [/test.php:45] | |
*/ | |
d(); | |
} | |
function handle_fatal_errors() | |
{ | |
debug_print_backtrace(); // here I won't have the full trace | |
/* | |
--- WITHOUT XDEBUG --- | |
Fatal error: Call to undefined function d() in /test.php on line 27 | |
#0 {closure}() | |
--- WITH XDEBUG --- | |
Fatal error: Call to undefined function d() in /test.php on line 28 | |
Call Stack: | |
0.0002 231104 1. {main}() /test.php:0 | |
0.0003 231832 2. will_fatal() /test.php:45 | |
0.0003 231864 3. a() /test.php:6 | |
0.0003 231896 4. b() /test.php:11 | |
0.0003 231928 5. c() /test.php:16 | |
#0 {closure}() | |
*/ | |
} | |
register_shutdown_function('handle_fatal_errors'); | |
will_fatal(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment