Index: modules/simpletest/drupal_web_test_case.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v retrieving revision 1.132 diff -u -r1.132 drupal_web_test_case.php --- modules/simpletest/drupal_web_test_case.php 30 Jul 2009 10:46:53 -0000 1.132 +++ modules/simpletest/drupal_web_test_case.php 3 Aug 2009 21:06:42 -0000 @@ -376,6 +376,11 @@ * FALSE. */ protected function error($message = '', $group = 'Other', array $caller = NULL) { + if ($group == 'User notice') { + // Instead of 'User notice' set by trigger_error(), use 'Debug'. + $group = 'Debug'; + } + return $this->assert('exception', $message, $group, $caller); } Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.951 diff -u -r1.951 common.inc --- includes/common.inc 31 Jul 2009 19:56:09 -0000 1.951 +++ includes/common.inc 3 Aug 2009 21:06:41 -0000 @@ -895,9 +895,11 @@ * An associative array with keys 'file', 'line' and 'function'. */ function _drupal_get_last_caller($backtrace) { - // Errors that occur inside PHP internal functions - // do not generate information about file and line. - while ($backtrace && !isset($backtrace[0]['line'])) { + // Errors that occur inside PHP internal functions do not generate + // information about file and line. Ignore black listed functions. + $blacklist = array('dd'); + while (($backtrace && !isset($backtrace[0]['line'])) || + (isset($backtrace[1]['function']) && in_array($backtrace[1]['function'], $blacklist))) { array_shift($backtrace); } @@ -4847,3 +4849,24 @@ } variable_set('css_js_query_string', $new_character . substr($string_history, 0, 19)); } + +/** + * Debug function used for outputting debug information. + * + * The debug information is passed on to trigger_error() after being converted + * to a string using _drupal_debug_message(). + * + * @param $data + * Data to be output. + * @param $label + * Label to prefix the data. + * @param $print_r + * Flag to switch between print_r() and var_export() for data conversion to + * string. Set $print_r to TRUE when dealing with a recursive data structure + * as var_export() will generate an error. + */ +function dd($data, $label = NULL, $print_r = FALSE) { + // Print $data contents to string. + $string = $print_r ? print_r($data, TRUE) : var_export($data, TRUE); + trigger_error(trim($label ? "$label: $string" : $string)); +}