Review main Merged

64877[BUGFIX] Adjust processing order of routes during URL generation

Oliver Hader CR +2 V +2 Hard +541 −13 updated 07/28/20, 14:38

Commit message

Prior to this patch routes were processed in reverse definition order.
Routes defined last came first. Depending on the existence of variable
defaults this behavior produced a couple of unexpected results.

  first:
    routePath: '/route/{a}/{b}'
  second:
    routePath: '/route/{c}'
    defaults:
      c: '0'

The example above, processed in reverse order and having parameters
`a` and `b` given, still resulted in `second` route being used since
the missing parameter `c` was defined by corresponding variable default.

This change adjusts the order of routes depending on given parameters,
completeness of a route (when all parameters are given, even defaults).
Sorting is adjusted based on the following criteria:

* default routes (e.g. `/my-page`) - processed later
* static routes (e.g. `/my-page/list`) - processed later
* all variables are given (complete) - processed earlier
  (e.g. parameters `a` and `b` are given for route `/route/{a}/{b}`)
* all mandatory variables are given (complete) - processed earlier
* less missing variable defaults - processed earlier
* less variable defaults amount - processed earlier

Tests in class `RouteSorterTest` provide more examples & details.

Review

  • Code review CR +2 Done
    • Oliver Hader +2
    • Aimeos +1
    • Benni Mack +1
  • Verified V +2 Done
    • Oliver Hader +2
    • Aimeos +1
    • Benni Mack +1
    • TYPO3com +1 CI

Issues 1

Files 6

Review log 1116

  1. Oliver Hader uploaded patch set 1 06/15/20, 16:06

  2. TYPO3com voted on patch set 1 V -1 06/15/20, 16:18 Completed build in 11m 31s on Mon, 15 Jun, 04:18 PM Test Summary: 1521 of 73383 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3917

  3. Oliver Hader uploaded patch set 2 06/16/20, 09:22

  4. TYPO3com voted on patch set 2 V +1 06/16/20, 09:37 Completed build in 15m 00s on Tue, 16 Jun, 09:37 AM Test Summary: 72896 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3918

  5. Oliver Hader uploaded patch set 3 06/16/20, 14:37

  6. TYPO3com voted on patch set 3 V +1 06/16/20, 14:51 Completed build in 13m 57s on Tue, 16 Jun, 02:51 PM Test Summary: 72896 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3921

  7. Oliver Hader uploaded patch set 4 06/16/20, 22:09

  8. Oliver Hader commented on patch set 4 06/16/20, 22:12

    This change is ready for review.
  9. TYPO3com voted on patch set 4 V +1 06/16/20, 22:21 Completed build in 12m 19s on Tue, 16 Jun, 10:21 PM Test Summary: 72938 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3936

  10. Oliver Hader uploaded patch set 5 06/16/20, 22:25

  11. TYPO3com voted on patch set 5 V +1 06/16/20, 22:38 Completed build in 13m 22s on Tue, 16 Jun, 10:38 PM Test Summary: 72938 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3937

  12. Benni Mack voted on patch set 5 V +1 CR +1 06/29/20, 07:32

  13. Aimeos commented on patch set 5 V +1 CR +1 07/08/20, 07:33

    Works now in a much better way
  14. Oliver Hader voted on patch set 5 V +2 CR +2 07/15/20, 21:13

  15. Oliver Hader merged patch set 6 07/15/20, 21:13

  16. Markus Klein commented on patch set 6 07/28/20, 14:38

    ExtbasePluginEnhancer.php:150 Unresolved

    Regression reported here: https://forge.typo3.org/issues/91880