-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
UrlMatcher BC break #31066
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
Comments
Please upgrade to 4.2 as 4.1 is not maintained anymore and this might have been fixed already. |
Reproduced with
|
Is this the same as #30863? |
This does not have to do anything with redirection, but route matching. This can be related to #30863, but I'm not sure if it is. |
I think we're not going to change the current behavior. There have been many back and forth on the topic and things are pretty stable right now around the current behavior. Sorry to ask you to do so, but please update/reorder your routes to make them work. |
I'm using If I define route with path |
With #31107, |
Yes, and that is a BC break. If it's not going to be fixed I have two options:
+ if (ends_with($url, '/') && $url === rtrim($url, '/')) {
+ throw new ResourceNotFoundException();
+ }
$urlMatcher->match($url); |
Or updating the routes you define I believe. Without knowing more about your use case and your route collection, I'm not sure I can help you more, but the behavior change is likely not going to be reverted... |
OK, let's imagine https://github.com/umpirsky/SUMT/blob/master/src/Umpirsky/SUMT/UrlMatcherTest.php is my use case. How can route update keep the tests pass with the new Symfony version? |
With #31107, tests pass on my machine. |
Great, thanks! But it will never be merged into |
:( |
…railing vars (nicolas-grekas) This PR was merged into the 4.2 branch. Discussion ---------- [Routing] fix trailing slash redirection with non-greedy trailing vars | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #30863, #31066 | License | MIT | Doc PR | - Fixes redirecting `/123/` to `/123` when the route is defined as `/{foo<\d+>}` Commits ------- d88833d [Routing] fix trailing slash redirection with non-greedy trailing vars
Symfony version(s) affected: 4.1.11
Description
With version
4.1.2
, urls with trailing slash were not matched, in4.1.11
they are. I guess it's related to https://symfony.com/doc/4.1/routing.html#routing-trailing-slash-redirection, but it's a BC break.How to reproduce
I created demo project https://github.com/umpirsky/SUMT which makes it easy to prove this two versions are not behaving the same way while using Symfony public API which should be stable across minor upgrades:
The text was updated successfully, but these errors were encountered: