[BUGFIX] Enhance matching order for regex based redirects
RegEx redirects have been processed in the order how they have been inserted into the database ignoring the flag `respect_query_parameters` completely. Due to this fact, a non-query argument based regex redirect would match before a concrete query-argument aware regexp redirect have been matched - additionally favored by the changes introduced with #96480 to provide a fallback. To combine all use-cases and additionally fix the detected issues, this change now splits the cached regex redirects into two flavors: * `regexp_respect_query_parameters` * `regexp_flat` That follows the pre-selection for the non-regex redirects. Redirects respecting query paramaters have higher precedence above the non-respecting once. Therefore, the matching flow in the `RedirectService` has been aligned correspondingly to respect this separated workflow. The #96480 is now only applied for regex redirects which do not respect query-arguments at all. It should be considered if we should remove that safety fallback and enforce correct regex redirects in a dedicated future change. Furthermore, a deterministic sorting criteria chain has been added to the `RedirectCacheService` to ensure a deterministic loading and caching order of redirects. The changes play together, which is the reason why they are included in one change and to avoid a inbetween incorrect test chain. Regression tests have been added to cover the cases. Resolves: #101191 Related: #96480 Releases: main, 12.4, 11.5 Change-Id: I9638835c33809e92ba883efb65d86bb1e9f5031b Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80079 Tested-by:Stefan B�rk <stefan@buerk.tech> Reviewed-by:
Stefan B�rk <stefan@buerk.tech> Tested-by:
core-ci <typo3@b13.com>
Showing
- typo3/sysext/redirects/Classes/Service/RedirectCacheService.php 11 additions, 2 deletions...sysext/redirects/Classes/Service/RedirectCacheService.php
- typo3/sysext/redirects/Classes/Service/RedirectService.php 34 additions, 11 deletionstypo3/sysext/redirects/Classes/Service/RedirectService.php
- typo3/sysext/redirects/Tests/Functional/Service/Fixtures/RegExp/case1.csv 9 additions, 0 deletions...irects/Tests/Functional/Service/Fixtures/RegExp/case1.csv
- typo3/sysext/redirects/Tests/Functional/Service/Fixtures/RegExp/case2.csv 9 additions, 0 deletions...irects/Tests/Functional/Service/Fixtures/RegExp/case2.csv
- typo3/sysext/redirects/Tests/Functional/Service/Fixtures/RegExp/case3.csv 9 additions, 0 deletions...irects/Tests/Functional/Service/Fixtures/RegExp/case3.csv
- typo3/sysext/redirects/Tests/Functional/Service/RedirectServiceTest.php 63 additions, 0 deletions...edirects/Tests/Functional/Service/RedirectServiceTest.php
- typo3/sysext/redirects/Tests/Unit/Service/RedirectServiceTest.php 2 additions, 1 deletion...sext/redirects/Tests/Unit/Service/RedirectServiceTest.php
Please register or sign in to comment