8000 GitHub · Where software is built
[go: up one dir, main page]

Skip to content
[Security] Adding a Flash Message still not working in Logout Subscriber #47247
Closed
@ThomasLandauer

Description

@ThomasLandauer

Symfony version(s) affected

5.4.11

Description

It looks like the problem described in #37292 wasn't solved completely in #37368.

I have a LogoutSubscriber that adds a flash message, and this gets lost.

How to reproduce

LogoutSubscriber:

public static function getSubscribedEvents(): array
{
    return [
        LogoutEvent::class => ['logout', 0],
    ];
}

Workaround: Setting the priority to -1, solves it, as suggested in #37292 (comment)

Possible Solution

If this can't be fixed, I'd come up with a PR for https://symfony.com/doc/5.4/security.html#customizing-logout - something like "Due to Symfony internals, when using an event subscriber to add a flash message, you need to set a negative priority, as shown here:..."

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0