diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 7a6d5aba85..2cf951e08e 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -460,6 +460,10 @@ function watchdog_exception($type, Exception $exception, $message = NULL, $varia * Use \Drupal::service('messenger')->addMessage() instead. */ function drupal_set_message($message = NULL, $type = 'status', $repeat = FALSE) { + // Workaround for code that can not check if the service exists. + if (!\Drupal::hasService('messenger')) { + return []; + } /* @var \Drupal\Core\Messenger\MessengerInterface $messenger */ $messenger = \Drupal::service('messenger'); $messenger->addMessage($message, $type, $repeat);