-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Make reverse routes match [_method => GET]
by default.
#12580
Make reverse routes match [_method => GET]
by default.
#12580
Conversation
I'm looking at the two integration test failures now... |
The With the change in this PR, the tests that perform reverse lookups need to be tweaked to make sure they still match the expected route. Further details are in the commit's message. |
This change in default behaviour should target |
He considers this a bugfix. Is the current behavior broken somewhat, so that this warrants a change in behavior in a patch release? |
@ADmad Does that override @dereuromark just tagging this PR for |
I'm fine either way-- I have a workaround in place using Router::addUrlFilter(function ($params, $request) {
return $params + ['_method' => 'GET'];
}); in my bootstrap.php file. Just say the word and I'll rebase on 3.next. |
Was this behavior always broken/wrong? Or was this a change introduced at some point? |
It might be unexpected behaviour but it's not a bugfix. You had to change other tests to account for your patch, so it's quite possible the change might cause problems in existing apps too. |
@ADmad That was already discussed with @markstory in #11467 but admittedly we didn't reach a final conclusion. (And I would argue I had to correct tests that depended on incorrect behavior, but semantics. 🤷♀️ ) |
Verifies the existence of the issue mentioned here: cakephp#11467 (comment)
In `::testArrayUrls()`, we declare an explicit `_method` to bypass the early GET-only route declared in `::setUp()` that would otherwise now match first. In `::testAssertRedirect()`, we update the Location in Response we're testing against (since it's a GET), and then update the static string URL to match. We do this since we want the array-based reverse route lookup to match the earlier `/get/tasks/index` route now.
bdac485
to
09f1772
Compare
@dereuromark I've changed the target, but don't forget to change the milestone too. Thanks for the input, folx. |
@ADmad Can you think of scenarios in your applications this would break? I think this falls under the realm of bugfixes as its unexpected that using |
Not in my applications but I can't say about others. If you think this should go in a bugfix release then I am fine with it. |
For my 2 cents:
|
As discussed in #11467 (comment thread starts here), this PR adjusts reverse routing to match by default routes that explicitly declare
[_method => GET]
. This is best illustrated with an example: