Messages are repeated on redirect after changes for issue 3508299

Created on 20 July 2025, 14 days ago

Problem/Motivation

The changes for issue 3508299 have introduce a regression for a certain messages use case. I am developing a private module that uses middleware to add messages to pages when certain other criteria in the module are met. Unfortunately, when a redirect is involved in visiting a page, the message appears twice, despite the repeat flag being false. I used git bisect to narrow it down the the above listed change. Debugging showed that second request did not contain the message in the flashbag that had been added in the first request, resulting in it being added on both requests.

Steps to reproduce

I'll need to see if I can set up a sample site and some simple steps to repro.

Proposed resolution

Either fix or revert the change until a fix can be found.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.2 🔥

Component

system.module

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @bpietsch
  • Could we see enough of your code implementation to see if this is a bug or an API misunderstanding?

  • OK, One additional critical bit to reproduction is that you need to access session data in the middleware code in order to see the issue. That patch I've attached in comment #5 (3537044-3.patch) is a simple module that reproduces the issue. Install the module on the admin page (appears under development section), log-into the site and then visit any URL that redirects (such as "/user?check_logged_in=1"). This will reproduce in 11.2, but not 11.1.8 and also will not reproduce in 11.2 if session data is not accessed.

    Please let me know if you need further details.

  • In my case, the use of session is to access cached data that is expensive to retrieve. My use case is to display a warning to the logged in user based on this cached data on every page until that address the issue.

  • 🇳🇿New Zealand quietone

    If this problem was discovered on a version of Drupal that is not 11.x, add that information in the issue summary and leave the version at 11.x. In Drupal core changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies . Also mentioned on the version section of the list of issue fields documentation. Thanks.

  • @quietone, this is a regression between 11.1.8 and 11.2.0

Production build 0.71.5 2024