Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291177

MENU_MAX_PARTS defined three times

$
0
0

As Damien figured out in #2035877-9: URL with more than 10 slashes is not working in new routing system, we're using three identical constants for the same thing:

core/includes/menu.inc:const MENU_MAX_PARTS = 9;
core/includes/menu.inc:    $parts = array_slice($original_map, 0, MENU_MAX_PARTS);
core/includes/menu.inc:  // Note - the number of empty elements should be > MENU_MAX_PARTS.
core/includes/menu.inc:  $parts = explode('/', $link_path, MENU_MAX_PARTS);
core/includes/menu.inc:    $parts = explode('/', $path, MENU_MAX_PARTS);
core/modules/menu_link/lib/Drupal/menu_link/Plugin/Core/Entity/MenuLink.php:        $this->parts = explode('/', $this->link_path, MENU_MAX_PARTS);

and:

core/lib/Drupal/Core/Routing/RouteCompiler.php:  const MAX_PARTS = 9;
core/lib/Drupal/Core/Routing/RouteCompiler.php:    $parts = explode('/', trim($path, '/'), static::MAX_PARTS);

and:
core/lib/Drupal/Core/Routing/MatcherDumper.php:  const MAX_PARTS = 9;
core/lib/Drupal/Core/Routing/RouteProvider.php:    }), 0, MatcherDumper::MAX_PARTS);

This shouldn't be.
However, I'm not sure if constants can be injected. We certainly don't want the classes be dependent on our procedural code.
Also, that restriction could probably go away as soon as our new routing system is fully decoupled from our legacy Menu API?


Viewing all articles
Browse latest Browse all 291177

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>