diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 8ff7379..35710e8 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -940,9 +940,9 @@ function _drupal_get_filename_fallback($type, $name, $trigger_error, $database_u $file_scans['#write_cache'] = TRUE; } - // If requested, trigger a user-level warning about the missing or + // If requested, trigger a user-level notice about the missing or // unexpectedly moved file. If the database was unavailable, do not trigger a - // warning in the latter case, though, since if the {system} table could not + // notice in the latter case, though, since if the {system} table could not // be queried there is no way to know if the location found here was // "unexpected" or not. if ($trigger_error) { @@ -1058,7 +1058,7 @@ function _drupal_get_filename_perform_file_scan($type, $name) { } /** - * Triggers a user-level warning for missing or unexpectedly moved files. + * Triggers a user-level notice for missing or unexpectedly moved files. * * @param $type * The type of the item (theme, theme_engine, module, profile). @@ -1085,10 +1085,10 @@ function _drupal_get_filename_fallback_trigger_error($type, $name, $error_type) // triggered during low-level operations that cannot necessarily be // interrupted by a watchdog() call. if ($error_type == 'missing') { - _drupal_trigger_error_with_delayed_logging(format_string('The following @type is missing from the file system: %name. For information about how to fix this, see the documentation page.', array('@type' => $type, '%name' => $name, '@documentation' => 'https://www.drupal.org/node/2487215')), E_USER_WARNING); + _drupal_trigger_error_with_delayed_logging(format_string('The following @type is missing from the file system: %name. For information about how to fix this, see the documentation page.', array('@type' => $type, '%name' => $name, '@documentation' => 'https://www.drupal.org/node/2487215'))); } elseif ($error_type == 'moved') { - _drupal_trigger_error_with_delayed_logging(format_string('The following @type has moved within the file system: %name. In order to fix this, clear caches or put the @type back in its original location. For more information, see the documentation page.', array('@type' => $type, '%name' => $name, '@documentation' => 'https://www.drupal.org/node/2487215')), E_USER_WARNING); + _drupal_trigger_error_with_delayed_logging(format_string('The following @type has moved within the file system: %name. In order to fix this, clear caches or put the @type back in its original location. For more information, see the documentation page.', array('@type' => $type, '%name' => $name, '@documentation' => 'https://www.drupal.org/node/2487215'))); } $errors_triggered[$type][$name][$error_type] = TRUE; } diff --git a/includes/errors.inc b/includes/errors.inc index 7393148..9605fa7 100644 --- a/includes/errors.inc +++ b/includes/errors.inc @@ -238,8 +238,9 @@ function _drupal_log_error($error, $fatal = FALSE) { $class = 'error'; // If error type is 'User notice' then treat it as debug information - // instead of an error message, see dd(). - if ($error['%type'] == 'User notice') { + // instead of an error message, unless we know it came from somewhere + // other than debug(). + if ($error['%type'] == 'User notice' && !drupal_static('_drupal_trigger_error_with_delayed_logging')) { $error['%type'] = 'Debug'; $class = 'status'; } diff --git a/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test index 16ac171..cd464d3 100644 --- a/modules/simpletest/tests/bootstrap.test +++ b/modules/simpletest/tests/bootstrap.test @@ -583,25 +583,25 @@ class BootstrapGetFilenameWebTestCase extends DrupalWebTestCase { */ public function testWatchdog() { // Search for a module that does not exist in either the file system or the - // {system} table. Make sure that an appropriate warning is recorded in the + // {system} table. Make sure that an appropriate notice is recorded in the // logs. $non_existing_module = $this->randomName(); $query_parameters = array( ':type' => 'php', - ':severity' => WATCHDOG_WARNING, + ':severity' => WATCHDOG_NOTICE, ); - $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND severity = :severity', $query_parameters)->fetchField(), 0, 'No warning message appears in the logs before searching for a module that does not exist.'); + $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND severity = :severity', $query_parameters)->fetchField(), 0, 'No notice appears in the logs before searching for a module that does not exist.'); // Trigger the drupal_get_filename() call. This must be done via a request // to a separate URL since the watchdog() will happen in a shutdown // function, and so that SimpleTest can be told to ignore (and not fail as - // a result of) the expected PHP warnings generated during this process. + // a result of) the expected PHP notices generated during this process. variable_set('system_test_drupal_get_filename_test_module_name', $non_existing_module); $this->drupalGet('system-test/drupal-get-filename'); $message_variables = db_query('SELECT variables FROM {watchdog} WHERE type = :type AND severity = :severity', $query_parameters)->fetchCol(); - $this->assertEqual(count($message_variables), 1, 'A single warning message appears in the logs after searching for a module that does not exist.'); + $this->assertEqual(count($message_variables), 1, 'A single notice appears in the logs after searching for a module that does not exist.'); $variables = reset($message_variables); $variables = unserialize($variables); - $this->assertTrue(isset($variables['!message']) && strpos($variables['!message'], format_string('The following module is missing from the file system: %name', array('%name' => $non_existing_module))) !== FALSE, 'The warning message that appears in the logs after searching for a module that does not exist contains the expected text.'); + $this->assertTrue(isset($variables['!message']) && strpos($variables['!message'], format_string('The following module is missing from the file system: %name', array('%name' => $non_existing_module))) !== FALSE, 'The notice that appears in the logs after searching for a module that does not exist contains the expected text.'); } /** diff --git a/modules/simpletest/tests/system_test.module b/modules/simpletest/tests/system_test.module index fef539a..11f5806 100644 --- a/modules/simpletest/tests/system_test.module +++ b/modules/simpletest/tests/system_test.module @@ -501,8 +501,8 @@ function system_test_request_destination() { * Page callback to run drupal_get_filename() on a particular module. */ function system_test_drupal_get_filename() { - // Prevent SimpleTest from failing as a result of the expected PHP warnings - // this function causes. Any warnings will be recorded in the database logs + // Prevent SimpleTest from failing as a result of the expected PHP notices + // this function causes. Any notices will be recorded in the database logs // for examination by the tests. define('SIMPLETEST_COLLECT_ERRORS', FALSE); @@ -516,7 +516,7 @@ function system_test_drupal_get_filename() { * Page callback to run drupal_get_filename() and do a schema rebuild. */ function system_test_drupal_get_filename_with_schema_rebuild() { - // Prevent SimpleTest from failing as a result of the expected PHP warnings + // Prevent SimpleTest from failing as a result of the expected PHP notices // this function causes. define('SIMPLETEST_COLLECT_ERRORS', FALSE); @@ -542,7 +542,7 @@ function system_test_watchdog($log_entry) { if (!variable_get('system_test_drupal_get_filename_attempt_recursive_rebuild')) { return; } - if ($log_entry['type'] != 'php' || $log_entry['severity'] != WATCHDOG_WARNING) { + if ($log_entry['type'] != 'php' || $log_entry['severity'] != WATCHDOG_NOTICE) { return; } $module_name = variable_get('system_test_drupal_get_filename_test_module_name');