Messenger service can't set messages super early and loses reference to flashbag reference on rebuild

Created on 28 January 2018, over 6 years ago
Updated 21 March 2023, about 1 year ago

Problem/Motivation

When a new module is installed (kernel rebuild) the reference between the messenger service and the flashbag is reset. Any messenger service instantiated or any messages set before the this will be lost. See #474684-141: Allow themes to declare dependencies on modules

Also messages set in the early bootstrap are lost as well. Both of these are a regression introduced by #2760167: Add \Drupal\Core\Messenger\Messenger

Proposed resolution

Instead of injecting session.flash_bag into the messenger inject session so that when the messenger service adds a message the session is started.

Remaining tasks

User interface changes

None

API changes

In \Drupal\Core\Messenger\Messenger::__construct() change FlashBagInterface to SessionInterface

Data model changes

None

🐛 Bug report
Status

Needs review

Version

10.1

Component
System 

Last updated 1 day ago

No maintainer
Created by

🇬🇧United Kingdom kalpaitch

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024