File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -37,3 +37,34 @@ function format_bytes($bytes, $precision = 2)
3737 return round ($ bytes , $ precision ) . ' ' . $ units [$ pow ];
3838 }
3939}
40+
41+ if (!function_exists ('backtrace_as_string ' )) {
42+ function backtrace_as_string ()
43+ {
44+ ob_start ();
45+
46+ debug_print_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS );
47+ $ backtrace = ob_get_contents ();
48+
49+ ob_end_clean ();
50+
51+ return $ backtrace ;
52+ }
53+ }
54+
55+ if (!function_exists ('minimized_backtrace_as_string ' )) {
56+ function minimized_backtrace_as_string ()
57+ {
58+ $ minimized = [];
59+
60+ $ backtrace = backtrace_as_string ();
61+ $ backtrace = explode ("\n" , $ backtrace );
62+ foreach ($ backtrace as $ item ) {
63+ if (preg_match ('/(#\d+) .*? called at \[(.*?)\]/ ' , $ item , $ matches )) {
64+ $ minimized [] = $ matches [1 ] . ' ' . $ matches [2 ];
65+ }
66+ }
67+
68+ return implode ("\n" , $ minimized );
69+ }
70+ }
You can’t perform that action at this time.
0 commit comments