diff -u b/core/includes/bootstrap.inc b/core/includes/bootstrap.inc --- b/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -405,10 +405,7 @@ // Use a default value if $message is not set. if (empty($message)) { - // The exception message is run through - // \Drupal\Component\Utility\SafeMarkup::checkPlain() by - // \Drupal\Core\Utility\Error:decodeException(). - $message = '%type: !message in %function (line %line of %file).'; + $message = '%type: @message in %function (line %line of %file).'; } if ($link) { @@ -488,7 +485,10 @@ // Use a default value if $message is not set. if (empty($message)) { - $message = '%type: @message in %function (line %line of %file).'; + // The exception message is run through + // \Drupal\Component\Utility\SafeMarkup::checkPlain() by + // \Drupal\Core\Utility\Error:decodeException(). + $message = '%type: !message in %function (line %line of %file).'; } if ($link) { diff -u b/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php --- b/core/modules/migrate/src/MigrateExecutable.php +++ b/core/modules/migrate/src/MigrateExecutable.php @@ -363,7 +363,7 @@ */ protected function handleException(\Exception $exception, $save = TRUE) { $result = Error::decodeException($exception); - $message = $result['@message'] . ' (' . $result['%file'] . ':' . $result['%line'] . ')'; + $message = $result['!message'] . ' (' . $result['%file'] . ':' . $result['%line'] . ')'; if ($save) { $this->saveMessage($message); } @@ -405,7 +405,7 @@ */ protected function handleException(\Exception $exception, $save = TRUE) { $result = Error::decodeException($exception); - $message = $result['!message'] . ' (' . $result['%file'] . ':' . $result['%line'] . ')'; + $message = $result['@message'] . ' (' . $result['%file'] . ':' . $result['%line'] . ')'; if ($save) { $this->saveMessage($message); } diff -u b/core/modules/system/src/Tests/System/ErrorHandlerTest.php b/core/modules/system/src/Tests/System/ErrorHandlerTest.php --- b/core/modules/system/src/Tests/System/ErrorHandlerTest.php +++ b/core/modules/system/src/Tests/System/ErrorHandlerTest.php @@ -44,7 +44,7 @@ ); $error_user_notice = array( '%type' => 'User warning', - '@message' => 'Drupal is <awesome>', + '@message' => 'Drupal is awesome & amazing', '%function' => 'Drupal\error_test\Controller\ErrorTestController->generateWarnings()', '%file' => drupal_get_path('module', 'error_test') . '/error_test.module', ); diff -u b/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php b/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php --- b/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php +++ b/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php @@ -51,8 +51,9 @@ $monkey_love = $bananas; // This will generate a warning. $awesomely_big = 1/0; - // This will generate a user error. - trigger_error("Drupal is <awesome>", E_USER_WARNING); + // This will generate a user error. Includes an ampersand so we can + // check for any escaping. + trigger_error("Drupal is awesome & amazing", E_USER_WARNING); return []; } only in patch2: unchanged: --- a/core/modules/system/src/Tests/Common/SimpleTestErrorCollectorTest.php +++ b/core/modules/system/src/Tests/Common/SimpleTestErrorCollectorTest.php @@ -44,7 +44,7 @@ function testErrorCollect() { if (count($this->collectedErrors) == 3) { $this->assertError($this->collectedErrors[0], 'Notice', 'Drupal\error_test\Controller\ErrorTestController->generateWarnings()', 'ErrorTestController.php', 'Undefined variable: bananas'); $this->assertError($this->collectedErrors[1], 'Warning', 'Drupal\error_test\Controller\ErrorTestController->generateWarnings()', 'ErrorTestController.php', 'Division by zero'); - $this->assertError($this->collectedErrors[2], 'User warning', 'Drupal\error_test\Controller\ErrorTestController->generateWarnings()', 'ErrorTestController.php', 'Drupal is awesome'); + $this->assertError($this->collectedErrors[2], 'User warning', 'Drupal\error_test\Controller\ErrorTestController->generateWarnings()', 'ErrorTestController.php', 'Drupal is awesome & amazing'); } else { // Give back the errors to the log report. only in patch2: unchanged: --- a/core/modules/system/tests/modules/error_service_test/src/Logger/TestLog.php +++ b/core/modules/system/tests/modules/error_service_test/src/Logger/TestLog.php @@ -24,7 +24,7 @@ class TestLog implements LoggerInterface { public function log($level, $message, array $context = array()) { $trigger = [ '%type' => 'Exception', - '!message' => 'Deforestation', + '@message' => 'Deforestation', '%function' => 'Drupal\error_service_test\MonkeysInTheControlRoom->handle()', 'severity_level' => 3, 'channel' => 'php',