diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index ecc150a..ced9c4c 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -518,7 +518,8 @@ function watchdog_exception($type, Exception $exception, $message = NULL, $varia * (optional) The translated message to be displayed to the user. For * consistency with other messages, it should begin with a capital letter and * end with a period. A render array may also be provided for markup, but - * #attached is not supported. + * #attached is not supported. Additionally, any cache tags and contexts are + * ignored, however this is okay because page caching is disabled. * @param string $type * (optional) The message's type. Defaults to 'status'. These values are * supported: @@ -573,9 +574,9 @@ function drupal_set_message($message = NULL, $type = 'status', $repeat = FALSE) // (like assets) should not be supported. if (is_array($message)) { $rendered_message = \Drupal::service('renderer')->renderPlain($message); - // The rendering will have bubbled any #attached assets to the top level - // of $message. Assert that there are none. - assert('empty($message[\'#attached\']);', 'Render arrays passed to drupal_set_message() cannot have attached assets.'); + // The rendering will have all attachments bubbled to #attached in the top + // level of $message. Assert that there are none. + assert('empty($message[\'#attached\']);', 'Render arrays passed to drupal_set_message() cannot have attachments.'); $message = $rendered_message; } diff --git a/core/modules/system/src/Tests/Bootstrap/DrupalSetMessageTest.php b/core/modules/system/src/Tests/Bootstrap/DrupalSetMessageTest.php index e345f37..1d57018 100644 --- a/core/modules/system/src/Tests/Bootstrap/DrupalSetMessageTest.php +++ b/core/modules/system/src/Tests/Bootstrap/DrupalSetMessageTest.php @@ -61,7 +61,7 @@ function testDrupalSetMessage() { // Ensure render arrays fail with #attached when assertions are enabled. $this->drupalGet('system-test/drupal-set-message-fail'); - $this->assertText('Render arrays passed to drupal_set_message() cannot have attached assets.'); + $this->assertText('Render arrays passed to drupal_set_message() cannot have attachments.'); } /** @@ -69,10 +69,11 @@ function testDrupalSetMessage() { */ protected function error($message = '', $group = 'Other', array $caller = NULL) { // @todo Clean this up in https://www.drupal.org/node/2536560. - if (strpos($message, 'Render arrays passed to drupal_set_message() cannot have attached assets.') !== FALSE) { + if (strpos($message, 'Render arrays passed to drupal_set_message() cannot have attachments.') !== FALSE) { // We're expecting this error. return FALSE; } - parent::error($message, $group, $caller); + return parent::error($message, $group, $caller); } + }