Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[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

Closed

Conversation

@alexander-schranz
Copy link
Contributor

@alexander-schranzalexander-schranz commentedDec 15, 2021
edited
Loading

QA
Branch?5.4 for bug fixes
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#44616
LicenseMIT
Doc PRsymfony/symfony-docs#...

A session is normally not written when empty so we need to check for empty before set the session cookie.

TODO:

  • Test

hranicka and SimonVanacco reacted with heart emoji
$requestSessionCookieId =$request->cookies->get($sessionName);

if ($requestSessionCookieId &&$session->isEmpty()) {
$isSessionEmpty =$session->isEmpty();
Copy link
ContributorAuthor

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:

if ($requestSessionCookieId && ($sessioninstanceof Session ?$session->isEmpty() :empty($session->all()))) {

@carsonbot
Copy link

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) {
Copy link
Member

@nicolas-grekasnicolas-grekasDec 28, 2021
edited
Loading

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?

Copy link
ContributorAuthor

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.

nicolas-grekas reacted with thumbs up emoji
@carsonbotcarsonbot changed the titleSet session cookie only when not empty[HttpKernel] Set session cookie only when not emptyDec 28, 2021
@alexander-schranz
Copy link
ContributorAuthor

for making things simpler for me I moving this changes to#44634

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

3 participants

@alexander-schranz@carsonbot@nicolas-grekas

[8]ページ先頭

©2009-2025 Movatter.jp