-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Session cookie removed on second request if empty session. #45206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you try with 5.4-dev and confirm if the bug is still there? |
The bug is still there with 5.4-dev |
Hi guys, I have a similar issue. It is possible to maintain an empty session with the session cookie? After the latest patch (5.4.3) is also not possible to create the session cookie if session bags are empty and the session cookie doesn't exist. |
I'm curious what is the usecase to have an empty session? At current state you could also just write something into the session if it need to be kept: |
Hey, thanks for your report! |
Could I get an answer? If I do not hear anything I will assume this issue is resolved or abandoned. Please get back to me <3 |
Hey, I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen! |
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
symfony/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php
Lines 155 to 163 in 3cbef85
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
The text was updated successfully, but these errors were encountered: