-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Deprecate checking for cacheable HTTP methods in Request::isMethodSafe() #20603
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
4d3ecac
to
af59fc8
Compare
This would force all projects that use the method in the intended way to update their code to get rid of the deprecation message. I am not sure if they will be really happy about that. |
Yes, as much as we are otherwise forcing people (e.g. Drupal) to update their code. That's why BC break are bad :) |
And deprecations do never force anyone to update their code, unless they decide to do so to prepare for next major. |
af59fc8
to
d7e7035
Compare
Sure, but Drupal is misusing the concept of safe methods. Thus IMO it's fair to have them update their code. How do you see the method in 4.0? Will it have a completely useless parameter? How do we deal with code that triggered deprecations in 3.x? It will then still work (somehow) and the deprecation is gone? |
We have to acknowledge that we opened a big trap :-) In OSS, "the code is doc", so they just shopped for the right method and they chose right at the time they decided to use this one. Nowhere in the doc nor in the code do we mention that this method was intended to behave like RFC 7231!
With the code path triggering the deprecation removed. And keeping calls that have the useless param asis for cross-major-version compat yes. Then maybe deprecate any args at all in 4.1.
As noted in the deprecation message, code may be updated to either adding false as argument, or use |
If we acknowledge that the previous method was not clear enough in telling that it provided an implementation of the RFC spec, I suggest that we completely deprecate the method. We can then introduce a new one dealing with the "safe" keyword and have the
Which would be weird if you really wanted to use the method in the RFC-compatible way. Because you then for Symfony 3.x compatibility you add the |
true, we already created such migration path for 3.0, e.g. the |
Not even that. We looked at |
That's true, but you needed to adapt your code to be compatible with Symfony 3.x. However, if you are currently only relying on the safe semantic of an HTTP method, you wouldn't have to update your code in 4.x to make it work the same. That's why I think we could then better deprecate the method itself and think about a more meaningful one (something like |
instead of renaming, the plan could be:
that way, things must be explicit. WDYT? |
d7e7035
to
34e7b95
Compare
@xabbuh PR updated accordingly |
…dSafe() (nicolas-grekas) This PR was merged into the 2.7 branch. Discussion ---------- [HttpKernel] Revert BC breaking change of Request::isMethodSafe() | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | yes (reverting a previous BC break) | Deprecations? | no | Tests pass? | yes | Fixed tickets | #20562 | License | MIT | Doc PR | - As spotted in #20562, we should not have broken a minor version. Instead, we should have deprecated the bad behavior. This is done in #20603. Commits ------- 0c3b7d7 [HttpKernel] Revert BC breaking change of Request::isMethodSafe()
Thank you @nicolas-grekas. |
… in Request::isMethodSafe() (nicolas-grekas) This PR was merged into the 3.2 branch. Discussion ---------- [HttpKernel] Deprecate checking for cacheable HTTP methods in Request::isMethodSafe() | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | no | Fixed tickets | - | License | MIT | Doc PR | - Late deprecation for 3.2, see #20602. Commits ------- 34e7b95 [HttpKernel] Deprecate checking for cacheable HTTP methods in Request::isMethodSafe()
We should then at least also update the method documentation to make clear what "safe" means. Otherwise, we risk to run into the same issue again in the future. |
"safe" is defined by RFC7231, and it even includes this very explicit statement:
It is really confusing for the users when this inexplicably deviates from the spec... The way I see it, this should have been considered a bug and fixed instead. |
@teohhanhui Please have a look at the discussion in #20562. |
Late deprecation for 3.2, see #20602.