[BUGFIX] Ensure best matching URL is used during site resolving
Symfony's UrlMatcher takes multiple routes and returns the first match. However there might be better matches that are not considered at all. That's why a custom BestUrlMatcher is introduce, which resolves all matches for further reduction. Previously the route collection was sorted by names and identifiers, which now has been adjusted to focus on the actual matches when being compared to the current request. The fallback route (site base URI). This way, overlapping route definitions can be resolved better. Resolves: #93240 Releases: main, 11.5 Change-Id: Ib1a7361dc86ed48a474d5e55583a622df58e8939 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/76464 Tested-by:Benni Mack <benni@typo3.org> Tested-by:
Susanne Moog <look@susi.dev> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Oliver Hader <oliver.hader@typo3.org> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Susanne Moog <look@susi.dev> Reviewed-by:
Oliver Hader <oliver.hader@typo3.org>
Showing
- typo3/sysext/core/Classes/Routing/BestUrlMatcher.php 151 additions, 0 deletionstypo3/sysext/core/Classes/Routing/BestUrlMatcher.php
- typo3/sysext/core/Classes/Routing/MatchedRoute.php 83 additions, 0 deletionstypo3/sysext/core/Classes/Routing/MatchedRoute.php
- typo3/sysext/core/Classes/Routing/SiteMatcher.php 7 additions, 30 deletionstypo3/sysext/core/Classes/Routing/SiteMatcher.php
- typo3/sysext/core/Tests/Unit/Routing/SiteMatcherTest.php 89 additions, 15 deletionstypo3/sysext/core/Tests/Unit/Routing/SiteMatcherTest.php
Please register or sign in to comment