Updated: Comment #0
Problem/Motivation
MatcherDumper::MAX_PARTS denotes the maximum number of parts a path can have in the new routing system.
This limitation is carried over from the old menu system. It is one, that we should try to avoid, though, if possible. In config_translation.module we have already hit the limit and need to work around it by providing multiple levels of pages all on one route. (Instead of /.../translate/add/fr we have to do /.../translate?action=add&langcode=fr and then dispatch to the appropriate forms ourselves by checking the request query.)
Currently MatcherDumper::MAX_PARTS is only used in one place in core and it can very easily be avoided.
Proposed resolution
Remove MatcherDumper::MAX_PARTS
Remaining tasks
User interface changes
API changes
Comments
Comment #1
tstoecklerLet's see if PhpStorm is actually right and there is only one usage in core.
Comment #2
amateescu commentedShouldn't we remove array_slice() entirely?
Comment #3
dawehnerIt is easy to remove MatcherDumper::MAX_PARTS but how do we want to deal with MENU_MAX_DEPTH and MENU_MAX_PARTS as these are actually used in several places.
Comment #4
amateescu commentedYeah, menu links are not ready for that..
Comment #5
dawehnerOn the other hand though these functions are indeed just used for menu links.
The other systems like local tasks/local actions/breadcrumbs now work independent from that and should not have any limitations.
Comment #6
tstoecklerRight, the fact that you can actually have routes with more parts, but that getRoutesByPath() will not find them is actually a bug report.
The fact that menu links will still have this limitation in D8 is unfortunate, but yeah...
Also super facepalm for #2, here's a fix for that.
Comment #8
tstoeckler#6: 2120505-6.patch queued for re-testing.
Comment #10
tstoecklerSo, the array keys get retained by array_filter() but not by array_slice(). Interesting.
While looking into RouteProvider::getCandidateOutlines() I realized that because we do bitwise comparison in there, we only support paths with 32/64 parts (depending on the system). This is already the case, however, so I think should not be changed in any way here. I.e. if you currently extend RouteProvider and simply do RouteProvider::MAX_PARTS = 100, you will notice the same thing.
Comment #12
tstoecklerBreakpointGroupCRUDTest.php, Line 29
Comment #13
tstoeckler#10: 2120505-10.patch queued for re-testing.
Comment #14
dawehnerLet's also extend the test coverage for it.
Comment #15
tstoecklerAwesome, thanks!
Uploading a tests-only patch to prove the validity of the tests.
Comment #16
tstoecklerComment #17
tstoecklerComment #19
tstoecklerNicely fails the correct assertions.
Can't RTBC myself, though :-/
Comment #20
dawehnerWell ... your last 3 patches dropped the test coverage again.
Comment #21
gábor hojtsy@dawehner: the last patch is in #14, the others are notifications of files *hidden*, not new files posted.
Comment #22
gábor hojtsyAlso looks good to me.
Comment #23
dawehnerOh, you are right.
Comment #24
tstoecklerBtw: #2132795: Remove \Drupal\Core\Routing\RouteCompiler::MAX_PARTS
Comment #25
webchickThis indeed seems to be a holdover from the old routing system. No tests had to be changed to allow this to work, but we nicely get extra test coverage for crazy paths. :)
Committed and pushed to 8.x. Thanks!