-
Notifications
You must be signed in to change notification settings - Fork 50
Allow respect_cache_headers to be "false" #166
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
@stof, have you seen this issue before? Do you know a workaround? |
hmm, I think the enumNode was always used with strings until now, which is why such issue was never spotted before |
Thank you. I use a ScalarNode for this now. |
->beforeNormalization() | ||
->always(function ($v) { | ||
@trigger_error('The option "respect_cache_headers" is deprecated since version 1.3 and will be removed in 2.0. Use "respect_response_cache_directives" instead.', E_USER_DEPRECATED); | ||
|
||
return $v; | ||
}) | ||
->end() | ||
->validate() | ||
->ifNotInArray([null, true, false]) |
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 one should be indented inside ->validate
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.
Thank you
->beforeNormalization() | ||
->always(function ($v) { | ||
@trigger_error('The option "respect_cache_headers" is deprecated since version 1.3 and will be removed in 2.0. Use "respect_response_cache_directives" instead.', E_USER_DEPRECATED); | ||
|
||
return $v; | ||
}) | ||
->end() |
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.
the end call should be unindented to make the tree structure visual. This is the end of ->beforeNormalization()
->ifNotInArray([null, true, false]) | ||
->thenInvalid('Value for "respect_cache_headers" must be null or boolean') | ||
->ifNotInArray([null, true, false]) | ||
->thenInvalid('Value for "respect_cache_headers" must be null or boolean') |
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.
ifNotInArray
does not create a new node in the tree (otherwise it would need an end node too). It configures the validation node. So this one should be unindented (it was right before your last update)
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.
Sorry, it was me that misunderstood. Thank you.
Thank you for the reviews. |
This PR adds a test for an issue I found.
We define
respect_cache_headers
like:On Symfony 2.8, the EnumNode runs
array_unique
over the possible values. Though,null
andfalse
is treated the same. See https://3v4l.org/KWuNPThis will result in that the possible values for
respect_cache_headers
will only betrue
andnull
. This issue will break BC since we promise that all previous configuration will work on newer versions.FYI: In the last release we defined the
respect_cache_headers
like: