Improve parsing of route definitions and deleted vars

This commit is contained in:
Kijin Sung 2020-06-17 12:33:21 +09:00
parent bb3d1f08a1
commit a814b4e334
3 changed files with 28 additions and 16 deletions

View file

@ -120,7 +120,6 @@ class Router
// Separate the prefix and the internal part of the URL.
$prefix = $matches[1];
$internal_url = $matches[2] ?? '';
// Find the module associated with this prefix.
$action_info = self::_getActionInfoByPrefix($prefix);
if ($action_info)
@ -372,7 +371,7 @@ class Router
$matched_arguments = array_intersect_key($route_vars['vars'], $vars);
if (count($matched_arguments) === count($route_vars['vars']))
{
$reordered_routes[$route] = $route_vars['priority'] ?: count($matched_arguments);
$reordered_routes[$route] = ($route_vars['priority'] * 1000) + count($matched_arguments);
}
}
if (!count($reordered_routes))