Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Session cookie removed on second request if empty session. #45206

Copy link
Copy link
@tomme87

Description

@tomme87
Issue body actions

Symfony version(s) affected

5.4.3

Description

After creating a session it always get removed the next request.

Looks like this started happening after #41390

If you look at

if ($requestSessionCookieId && $session->isEmpty()) {
$response->headers->clearCookie(
$sessionName,
$sessionCookiePath,
$sessionCookieDomain,
$sessionCookieSecure,
$sessionCookieHttpOnly,
$sessionCookieSameSite
);

It removes cookie if session is empty. My session is always empty. I just need to have a session, even if it's empty.

How to reproduce

Start a session without data and the cookie will get removed immediately after.

Possible Solution

Never remove the cookie unless it's expired or removed explicitly?

Additional Context

Discussion in #44634 looks relevant

Reactions are currently unavailable

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.