Skip to content

Instantly share code, notes, and snippets.

@tsmith512
Created April 30, 2013 16:19
Show Gist options
  • Save tsmith512/5489802 to your computer and use it in GitHub Desktop.
Save tsmith512/5489802 to your computer and use it in GitHub Desktop.
Quick-n-dirty patch to Drupal 7 bootstrap to examine backtraces on error messages. Requires devel enabled.
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index fe3d7a7..c2c95cc 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -1794,6 +1794,11 @@ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NO
*/
function drupal_set_message($message = NULL, $type = 'status', $repeat = TRUE) {
if ($message) {
+
+ if ($type == 'error') {
+ $message = kprint_r( debug_backtrace(), TRUE, $message );
+ }
+
if (!isset($_SESSION['messages'][$type])) {
$_SESSION['messages'][$type] = array();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment