Skip to content

[HttpKernel] Provide migration path for TestSessionListener #41446

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
Jun 1, 2021

Conversation

jderusse
Copy link
Member

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

When working on #41321 I realized that #41343 was wrong for TestSessionListener.
Injecting the factory in both SessionListener AND TestSessionListener would generate 2 distinguished session instances which is the opposite of the expected behavior: TestSessionListener needs the session used by the request to set the right sessionId in the cookie.

This PR fallback to request->getSession() when there is no session injected in the container (ie: FrameworkBundlke:6)

@carsonbot carsonbot changed the title [HttpKernel] Provide migration path for TestSessionListener Provide migration path for TestSessionListener May 29, 2021
@carsonbot carsonbot changed the title Provide migration path for TestSessionListener [HttpKernel] Provide migration path for TestSessionListener May 29, 2021
@derrabus derrabus added this to the 5.4 milestone May 30, 2021
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This topic is a can of worms :)
in SessionListener, shouldn't we update line 41?

@nicolas-grekas
Copy link
Member

Thank you @jderusse.

@nicolas-grekas nicolas-grekas merged commit 7714648 into symfony:5.4 Jun 1, 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 this pull request may close these issues.

4 participants