Skip to content

Navigation Menu

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

[HttpKernel] Fix SessionListener without session in request #44618

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

Merged
merged 1 commit into from
Dec 23, 2021
Merged

[HttpKernel] Fix SessionListener without session in request #44618

merged 1 commit into from
Dec 23, 2021

Conversation

shyim
Copy link
Contributor

@shyim shyim commented Dec 14, 2021

Q A
Branch? 5.3
Bug fix? yes
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

We have in our project a Listener for kernel.request which sets a Response object if it's a OPTIONS call. A setResponse in the event does stopping all other listeners also the session listener. As the session listener is not triggered in the kernel.request the followup kernel.response event will let the session listener crash.

https://github.com/symfony/symfony/blob/5.3/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php#L80

This line tries to get the session from the container, if its missing it calls getSession this throws then a error Session is not set.

It looks like this issue has been fixed already in Symfony 6. See https://github.com/symfony/symfony/blob/6.1/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php#L99-L101

@carsonbot carsonbot added this to the 6.1 milestone Dec 14, 2021
@shyim shyim changed the base branch from 6.1 to 5.3 December 14, 2021 14:44
@solverat
Copy link

Yes! Just tested it! I'm struggling with this since I've updated to 5.4. It's a quite rare situation, but in my case I'm having a very early RedirectResponse which crashes with a Session has not been set. So +1 from my side!

@jderusse
Copy link
Member

@shyim could you have a look to the failing test please?

@shyim
Copy link
Contributor Author

shyim commented Dec 22, 2021

I can look tomorrow into it

@shyim
Copy link
Contributor Author

shyim commented Dec 23, 2021

@jderusse Rebased more jobs are green. MacOS failure doesn't seems to be from my side

@jderusse
Copy link
Member

Thank you @shyim.

@jderusse jderusse merged commit e9779ec into symfony:5.3 Dec 23, 2021
This was referenced Dec 29, 2021
@Thejaswini-Rao-U
Copy link

@solverat , How you solved this login isssue in symfony 5.4 ?

im also facing same issue, after giving correct credentials , im not able to login to dashboard or index page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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