Skip to content

[Messenger] Fix RequestContext not updated #41716

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 17, 2021

Conversation

jderusse
Copy link
Member

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

The RouterContextMiddleware updates the context of the injected RequestContextAwareInterface but this is wrong, the context object could have been injected in many services (ie. Router, UrlHelper).
Calling setContext updates the context for one services, but all other services are still using the old one.

This PR uses the injected RequestContextAwareInterface to fetch the current Context and then changes its properties.

@jderusse jderusse requested a review from sroze as a code owner June 15, 2021 14:05
@carsonbot carsonbot added this to the 5.3 milestone Jun 15, 2021
@carsonbot carsonbot changed the title [messenger] Fix RequestContext not updated [Messenger] Fix RequestContext not updated Jun 15, 2021
@jderusse jderusse force-pushed the messenger-reqcontext branch from c684139 to 9f020dc Compare June 15, 2021 14:21
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.

I don't have a better idea :(
router.request_context is another stateful service we need to ditch!
finding a way to remove RequestContextAwareInterface would be great also...

@jderusse jderusse force-pushed the messenger-reqcontext branch from 9f020dc to 4b109c3 Compare June 15, 2021 22:39
@jderusse jderusse force-pushed the messenger-reqcontext branch from 4b109c3 to 7ad1c44 Compare June 16, 2021 22:22
@nicolas-grekas
Copy link
Member

Thank you @jderusse.

@nicolas-grekas nicolas-grekas merged commit f8222f7 into symfony:5.3 Jun 17, 2021
@fabpot fabpot mentioned this pull request Jun 17, 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