Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.815 diff -u -p -r1.815 common.inc --- includes/common.inc 1 Nov 2008 21:21:34 -0000 1.815 +++ includes/common.inc 2 Nov 2008 04:38:25 -0000 @@ -615,6 +615,7 @@ function _drupal_error_handler($error_le E_RECOVERABLE_ERROR => 'Recoverable fatal error' ); $backtrace = debug_backtrace(); + // We treat recoverable errors as fatal. _drupal_log_error(isset($types[$error_level]) ? $types[$error_level] : 'Unknown error', $message, $backtrace, $error_level == E_RECOVERABLE_ERROR); } @@ -673,10 +674,25 @@ function _drupal_log_error($type, $messa // Do it early because drupal_set_message() triggers an init_theme(). if ($fatal && (drupal_get_bootstrap_phase() != DRUPAL_BOOTSTRAP_FULL)) { unset($GLOBALS['theme']); - define('MAINTENANCE_MODE', 'error'); + if (!defined('MAINTENANCE_MODE')) { + define('MAINTENANCE_MODE', 'error'); + } drupal_maintenance_theme(); } + // When running inside the testing framework, we relay the errors + // to the tested site by the way of HTTP headers. + if (preg_match("/^simpletest\d+/", $GLOBALS['db_prefix']) && !headers_sent() && !defined('SIMPLETEST_DONT_COLLECT_ERRORS')) { + static $number = 0; + $assertion = array( + $message, + $type, + $caller + ); + header('X-Drupal-Assertion-' . $number . ': ' . rawurlencode(serialize($assertion))); + $number++; + } + // Force display of error messages in update.php. if (variable_get('error_level', 1) == 1 || (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update')) { drupal_set_message(t('@type: %message in %function (line %line of %file).', array('@type' => $type, '%message' => $message, '%function' => $caller['function'], '%line' => $caller['line'], '%file' => $caller['file'])), 'error'); Index: modules/simpletest/drupal_web_test_case.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v retrieving revision 1.53 diff -u -p -r1.53 drupal_web_test_case.php --- modules/simpletest/drupal_web_test_case.php 1 Nov 2008 21:21:35 -0000 1.53 +++ modules/simpletest/drupal_web_test_case.php 2 Nov 2008 04:38:26 -0000 @@ -799,6 +799,7 @@ class DrupalWebTestCase { CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_SSL_VERIFYPEER => FALSE, // Required to make the tests run on https:// CURLOPT_SSL_VERIFYHOST => FALSE, // Required to make the tests run on https:// + CURLOPT_HEADERFUNCTION => array(&$this, 'curlHeaderCallback'), ); if (preg_match('/simpletest\d+/', $db_prefix, $matches)) { $curl_options[CURLOPT_USERAGENT] = $matches[0]; @@ -831,6 +832,21 @@ class DrupalWebTestCase { } /** + * Reads headers and registers errors received from the tested site. + * + * @see _drupal_log_error(). + * + * @param $ch the cURL handler. + * @param $header a header. + */ + protected function curlHeaderCallback($ch, $header) { + if (preg_match('/^X-Drupal-Assertion-[0-9]+: (.*)$/', $header, $matches)) { + call_user_func_array(array(&$this, 'error'), unserialize(urldecode($matches[1]))); + } + return strlen($header); + } + + /** * Close the cURL handler and unset the handler. */ protected function curlClose() { Index: modules/simpletest/tests/session_test.module =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/session_test.module,v retrieving revision 1.2 diff -u -p -r1.2 session_test.module --- modules/simpletest/tests/session_test.module 15 Sep 2008 15:18:59 -0000 1.2 +++ modules/simpletest/tests/session_test.module 2 Nov 2008 04:38:26 -0000 @@ -33,7 +33,12 @@ function session_test_menu() { * Page callback, prints the stored session value to the screen. */ function _session_test_get() { - return t('The current value of the stored session variable is: %val', array('%val' => $_SESSION['session_test_value'])); + if (!empty($_SESSION['session_test_value'])) { + return t('The current value of the stored session variable is: %val', array('%val' => $_SESSION['session_test_value'])); + } + else { + return ""; + } } /** Index: modules/simpletest/tests/system_test.module =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/system_test.module,v retrieving revision 1.4 diff -u -p -r1.4 system_test.module --- modules/simpletest/tests/system_test.module 15 Oct 2008 16:05:51 -0000 1.4 +++ modules/simpletest/tests/system_test.module 2 Nov 2008 04:38:26 -0000 @@ -146,6 +146,7 @@ function system_test_modules_uninstalled * Menu callback; generate warnings to test the error handler. */ function system_test_generate_warnings() { + define('SIMPLETEST_DONT_COLLECT_ERRORS', TRUE); // This will generate a notice. $monkey_love = $bananas; // This will generate a warning. @@ -159,6 +160,7 @@ function system_test_generate_warnings() * Menu callback; trigger an exception to test the exception handler. */ function system_test_trigger_exception() { + define('SIMPLETEST_DONT_COLLECT_ERRORS', TRUE); throw new Exception("Drupal is awesome"); } @@ -166,5 +168,6 @@ function system_test_trigger_exception() * Menu callback; trigger an exception to test the exception handler. */ function system_test_trigger_pdo_exception() { + define('SIMPLETEST_DONT_COLLECT_ERRORS', TRUE); db_query("SELECT * FROM bananas_are_awesome"); } Index: modules/trigger/trigger.module =================================================================== RCS file: /cvs/drupal/drupal/modules/trigger/trigger.module,v retrieving revision 1.20 diff -u -p -r1.20 trigger.module --- modules/trigger/trigger.module 6 Oct 2008 12:55:56 -0000 1.20 +++ modules/trigger/trigger.module 2 Nov 2008 04:38:26 -0000 @@ -393,8 +393,8 @@ function trigger_user_login(&$edit, &$ac /** * Implementation of hook_user_logout(). */ -function trigger_user_logout(&$edit, &$account, $category) { - _trigger_user('logout', $edit, $account, $category); +function trigger_user_logout(&$edit, &$account) { + _trigger_user('logout', $edit, $account); } /**