--- devel.module 2011-09-27 19:44:56.000000000 +0100 +++ devel.module 2011-10-07 19:31:55.000000000 +0100 @@ -11,6 +11,7 @@ define('DEVEL_QUERY_SORT_BY_DURATION', 1 define('DEVEL_ERROR_HANDLER_NONE', 0); define('DEVEL_ERROR_HANDLER_STANDARD', 1); define('DEVEL_ERROR_HANDLER_BACKTRACE', 2); +define('DEVEL_ERROR_HANDLER_BACKTRACE_AND_MESSAGE', 3); define('DEVEL_MIN_TEXTAREA', 50); @@ -541,6 +542,7 @@ function devel_set_handler($handler) { // do nothing break; case DEVEL_ERROR_HANDLER_BACKTRACE: + case DEVEL_ERROR_HANDLER_BACKTRACE_AND_MESSAGE: if (has_krumo()) { set_error_handler('backtrace_error_handler'); } @@ -610,6 +612,20 @@ function devel_boot() { drupal_register_shutdown_function('devel_shutdown'); } +/** + * Display backtrace showing the route of calls to the current error. + * + * @param $error_level + * The level of the error raised. + * @param $message + * The error message. + * @param $filename + * The filename that the error was raised in. + * @param $line + * The line number the error was raised at. + * @param $context + * An array that points to the active symbol table at the point the error occurred. + */ function backtrace_error_handler($error_level, $message, $filename, $line, $context) { // Hide stack trace and parameters from unqualified users. if (!user_access('access devel information')) { @@ -670,6 +686,12 @@ function backtrace_error_handler($error_ if (variable_get('error_level', 1) >= 1) { print t('%error: %message in %function (line %line of %file).', $variables) ." =>\n"; ddebug_backtrace(); + + // Also show the standard drupal message if this was requested via the admin option + // for both backtrace and message. + if (variable_get('devel_error_handler', DEVEL_ERROR_HANDLER_STANDARD) == DEVEL_ERROR_HANDLER_BACKTRACE_AND_MESSAGE) { + drupal_set_message(t('%error: %message in %function (line %line of %file).', $variables), ($type[1] <= WATCHDOG_ERROR ? 'error' : 'warning')); + } } watchdog('php', '%error: %message in %function (line %line of %file).', $variables, $type[1]); --- devel.admin.inc 2011-09-27 19:44:56.000000000 +0100 +++ devel.admin.inc 2011-10-07 18:41:56.000000000 +0100 @@ -108,11 +108,12 @@ function devel_admin_settings() { $form['devel_error_handler'] = array('#type' => 'radios', '#title' => t('Error handler'), '#default_value' => variable_get('devel_error_handler', DEVEL_ERROR_HANDLER_STANDARD), - '#options' => array(DEVEL_ERROR_HANDLER_NONE => t('None'), DEVEL_ERROR_HANDLER_STANDARD => t('Standard drupal')), + '#options' => array(DEVEL_ERROR_HANDLER_NONE => t('None'), DEVEL_ERROR_HANDLER_STANDARD => t('Standard Drupal')), '#description' => t('Choose an error handler for your site. Backtrace prints nice debug information when an error is noticed, and you choose to show errors on screen. Backtrace requires the krumo library. None is a good option when stepping through the site in your debugger.', array('@krumo' => url('http://krumo.sourceforge.net'), '@choose' => url('admin/config/development/logging'))), ); if (has_krumo()) { $form['devel_error_handler']['#options'][DEVEL_ERROR_HANDLER_BACKTRACE] = t('Backtrace'); + $form['devel_error_handler']['#options'][DEVEL_ERROR_HANDLER_BACKTRACE_AND_MESSAGE] = t('Backtrace plus standard Drupal'); } $options = drupal_map_assoc(array('default', 'blue', 'green', 'orange', 'white', 'disabled'));