8000 [HttpKernel] wrong usage of SessionUtils::popSessionCookie AbstractSessionListener · Issue #44434 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpKernel] wrong usage of SessionUtils::popSessionCookie AbstractSessionListener #44434

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

Closed
simonchrz opened this issue Dec 3, 2021 · 0 comments

Comments

@simonchrz
Copy link
Contributor
simonchrz commented Dec 3, 2021

Symfony version(s) affected

5.4.0

Description

On Kernel reponse we currently get two Set-Cookie header == one generated by php because of a session_start() call and the other one created by the symfony SessionListener. The parent class AbstractSessionListener wants to remove possible other Set-Cookie header by using the SessionUtils::popSessionCookie function. This doesn't works right now because of a wrong function usage == 2nd parameter is not the sessionId as expected.

The function onKernelResponse() removes possible Set-Cookie headers from headers_list by using SessionUtils::popSessionCookie($sessionName, $sessionCookiePath);
https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php#L149

2nd expected parameter of SessionUtils::popSessionCookie function is the sessionId, not the $sessionCookiePath
https://github.com/symfony/symfony/blob/v5.4.0/src/Symfony/Component/HttpFoundation/Session/SessionUtils.php#L28

How to reproduce

see description

Possible Solution

replace wrong parameter by $sessionId on https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php#L149

Additional Context

No response

@simonchrz simonchrz added the Bug label Dec 3, 2021
derrabus added a commit that referenced this issue Dec 6, 2021
…okie (simonchrz)

This PR was merged into the 5.4 branch.

Discussion
----------

[HttpKernel] Fix wrong usage of SessionUtils::popSessionCookie

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #44434
| License       | MIT

The function onKernelResponse() removes possible Set-Cookie headers from headers_list by using SessionUtils::popSessionCookie($sessionName, $sessionCookiePath);
https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php#L149

2nd expected parameter of SessionUtils::popSessionCookie function is the sessionId, not the $sessionCookiePath
https://github.com/symfony/symfony/blob/v5.4.0/src/Symfony/Component/HttpFoundation/Session/SessionUtils.php#L28

Commits
-------

36b466e use $sessionId instead of $sessionCookiePath on SessionUtils::popSessionCookie call
@fabpot fabpot closed this as completed Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0