PENDING …

ORIGINAL POST ↓

I find this useful as a less memory intensive Drupal-friendly way to backtrace PHP as a one-off code snippet to temporarily drop into a troublesome location without installing modules or server-side tools:

1
2
3
4
5
6
 $trace = debug_backtrace();
  $backtrace_lite = array();
  foreach( $trace as $call ) {
    $backtrace_lite[] = $call['function']."    ".$call['file']."    line ".$call['line'];
  }
  debug( $backtrace_lite, "TRACE", true );

It gets the backtrace into Drupal’s debugging system, but strips it down to the essentials to avoid failures when massive objects are involved. For handy reference, the other keys within each row of the debug_backtrace() object are: class, object, type, args.

Reference

Example Screenshot

2023.11.16 - 161209

2023.11.16 - 161203