Skip to content
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

Read attributes as provided by the event object, and pass on attributes to other event handlers (Case 177753) #15

Merged
merged 6 commits into from
Nov 19, 2024

Conversation

MalteWunsch
Copy link
Member

@MalteWunsch MalteWunsch commented Nov 19, 2024

This adapts webfactory/WebfactoryWfdMetaBundle#53:

This PR uses the new API introduced in symfony/symfony#46001 to read controller attributes through the ControllerEvent, and to make them available to other event handlers when replacing the controller.

This is necessary when using the Send304IfNotModified attribute in combination with \Symfony\Component\HttpKernel\Attribute\Cache. Without this change, \Symfony\Component\HttpKernel\EventListener\CacheAttributeListener will not set Cache headers accordingly. The result is that you may get 304 Not Modified responses on conditional requests with If-Modified-Since, but these are treated as stale/cache only in the HttpCache and have a Cache-Control: must-revalidate, private header.

And adds some tests.

MalteWunsch and others added 6 commits November 19, 2024 12:50
…or attributes

... and that we behave accordingly, by saving attributes in the event when replacing the controller inside the event.
... and save attributes of the original controller in the event when replacing the controller.
While ControllerEvent->getAttributes() has been introduced in http-kernel 6.2, we use it's more comfortable signature available in 6.4.
@MalteWunsch MalteWunsch marked this pull request as ready for review November 19, 2024 12:15
@MalteWunsch MalteWunsch changed the title Fix searching the Event instead of Controller for Attribute (Case 177753) Read attributes as provided by the event object, and pass on attributes to other event handlers (Case 177753) Nov 19, 2024
@MalteWunsch MalteWunsch merged commit f613d44 into master Nov 19, 2024
5 checks passed
@MalteWunsch MalteWunsch deleted the 177753-fix-eventlistener branch November 19, 2024 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant