-
Notifications
You must be signed in to change notification settings - Fork 83
Fix #105 #119
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
Conversation
@@ -15,7 +15,6 @@ | |||
use FOS\HttpCacheBundle\Configuration\Tag; | |||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |||
use Symfony\Component\HttpFoundation\Request; | |||
use Symfony\Component\HttpFoundation\Response; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused.
Before we merge this: is there a mismatch between |
+1 for the PR for the naming: this is remapped in FOSHttpCacheExtension::loadTagRules. so it works correctly atm. not sure what makes sense - maybe go for expression everywhere, to be consistent with the field in the |
I’m okay with |
green and merged :-) |
KernelEvents::RESPONSE => 'onKernelResponse' | ||
return $this->expressionLanguage->evaluate( | ||
$expression, | ||
$request->attributes->all() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does not have the Request itself anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it also did not have the request previously, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
depends. On line 81 it was passed. On line 122 it was not (and this call looks invalid by passing a Request in an argument expecting an array)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stof What do you mean exactly? evaluateTag(string $expression, Request $request)
wraps a call to $expressionLanguage->evaluate(string $expression, array $values)
. As far as I can see evaluateTag
is called twice, both times with a Request object:
https://github.com/FriendsOfSymfony/FOSHttpCacheBundle/blob/master/EventListener/TagSubscriber.php#L80
https://github.com/FriendsOfSymfony/FOSHttpCacheBundle/blob/master/EventListener/TagSubscriber.php#L127
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ddeboer the comment to which I replied was refering to the previous code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ddeboer well, SensioFRameworkExtraBundle is inconsistent. For @Security
, you get more stuff, like the request.
@dbu the behavior for @Security
is that known params always win. this way, you always know that request
is the Request object. If you have a request attribute with the same name, you can always get it from the Request object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if we just add the request for advanced users, mention it in the doc but do not have any examples using the request, to keep them simple? the strategy to overwrite a possible request
attribute with the Request means that there would be a BC break if we would add this later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbu Ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #144
for that anyway