Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpKernel] Set session cookie only when not empty#44657
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
43c83f5 to3e4a8dfCompare3e4a8df toe89eb3aCompare| $requestSessionCookieId =$request->cookies->get($sessionName); | ||
| if ($requestSessionCookieId &&$session->isEmpty()) { | ||
| $isSessionEmpty =$session->isEmpty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Need in 6.0 be replaced with the new logic:
symfony/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php
Line 149 inb2e7fcd
| if ($requestSessionCookieId && ($sessioninstanceof Session ?$session->isEmpty() :empty($session->all()))) { |
carsonbot commentedDec 16, 2021
Hey! I think@mtarld has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
| $sessionCookieSameSite | ||
| ); | ||
| }elseif ($sessionId !==$requestSessionCookieId) { | ||
| }elseif ($sessionId !==$requestSessionCookieId && !$isSessionEmpty) { |
nicolas-grekasDec 28, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
maybe we should even notwrite the session in the backend when it's empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
If a value is removed we need to write it to remove that value from the session bag.
alexander-schranz commentedDec 29, 2021
for making things simpler for me I moving this changes to#44634 |
Uh oh!
There was an error while loading.Please reload this page.
A session is normally not written when empty so we need to check for empty before set the session cookie.
TODO: