Skip to content

Instantly share code, notes, and snippets.

@dotherightthing
Last active November 1, 2018 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dotherightthing/31757d6de1927538c0c253eae0d13242 to your computer and use it in GitHub Desktop.
Save dotherightthing/31757d6de1927538c0c253eae0d13242 to your computer and use it in GitHub Desktop.
[Generating a Stack Trace in PHP] What called what from where? #php #debugging #wordpress

Generating a Stack Trace

Source: StackOverflow - Print PHP Call Stack

Sample output when called from a WordPress Widget Subclass:

#0 /Volumes/DanBackup/Websites/wp-network/wp-includes/class-wp-widget-factory.php(106): WPDTRT_Widget->__construct()
#1 /Volumes/DanBackup/Websites/wp-network/wp-includes/widgets.php(113): WP_Widget_Factory->register('WPDTRT_Attachme...')
#2 /Volumes/DanBackup/Websites/wpdtrt-attachment-map/wpdtrt-attachment-map.php(202): register_widget('WPDTRT_Attachme...')
#3 [internal function]: wpdtrt_attachment_map_widget_1_init('')
#4 /Volumes/DanBackup/Websites/wp-network/wp-includes/class-wp-hook.php(298): call_user_func_array('wpdtrt_attachme...', Array)
#5 /Volumes/DanBackup/Websites/wp-network/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array)
#6 /Volumes/DanBackup/Websites/wp-network/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#7 /Volumes/DanBackup/Websites/wp-network/wp-settings.php(448): do_action('init')
#8 /Volumes/DanBackup/Websites/wp-network/wp-config.php(121): require_once('/Volumes/DanBac...')
#9 /Volumes/DanBackup/Websites/wp-network/wp-load.php(37): require_once('/Volumes/DanBac...')
#10 /Volumes/DanBackup/Websites/wp-network/wp-admin/admin.php(31): require_once('/Volumes/DanBac...')
#11 /Volumes/DanBackup/Websites/wp-network/wp-admin/widgets.php(10): require_once('/Volumes/DanBac...')
#12 {main}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment