File tree Expand file tree Collapse file tree 2 files changed +32
-31
lines changed Expand file tree Collapse file tree 2 files changed +32
-31
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ if (!function_exists ('backtrace_as_string ' )) {
4+ function backtrace_as_string ()
5+ {
6+ ob_start ();
7+
8+ debug_print_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS );
9+ $ backtrace = ob_get_contents ();
10+
11+ ob_end_clean ();
12+
13+ return $ backtrace ;
14+ }
15+ }
16+
17+ if (!function_exists ('minimized_backtrace_as_string ' )) {
18+ function minimized_backtrace_as_string ()
19+ {
20+ $ minimized = [];
21+
22+ $ backtrace = backtrace_as_string ();
23+ $ backtrace = explode ("\n" , $ backtrace );
24+ foreach ($ backtrace as $ item ) {
25+ if (preg_match ('/(#\d+) .*? called at \[(.*?)\]/ ' , $ item , $ matches )) {
26+ $ minimized [] = $ matches [1 ] . ' ' . $ matches [2 ];
27+ }
28+ }
29+
30+ return implode ("\n" , $ minimized );
31+ }
32+ }
Original file line number Diff line number Diff line change @@ -49,34 +49,3 @@ function format_xml($xml)
4949 return $ dom ->saveXML ();
5050 }
5151}
52-
53- if (!function_exists ('backtrace_as_string ' )) {
54- function backtrace_as_string ()
55- {
56- ob_start ();
57-
58- debug_print_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS );
59- $ backtrace = ob_get_contents ();
60-
61- ob_end_clean ();
62-
63- return $ backtrace ;
64- }
65- }
66-
67- if (!function_exists ('minimized_backtrace_as_string ' )) {
68- function minimized_backtrace_as_string ()
69- {
70- $ minimized = [];
71-
72- $ backtrace = backtrace_as_string ();
73- $ backtrace = explode ("\n" , $ backtrace );
74- foreach ($ backtrace as $ item ) {
75- if (preg_match ('/(#\d+) .*? called at \[(.*?)\]/ ' , $ item , $ matches )) {
76- $ minimized [] = $ matches [1 ] . ' ' . $ matches [2 ];
77- }
78- }
79-
80- return implode ("\n" , $ minimized );
81- }
82- }
You can’t perform that action at this time.
0 commit comments