diff --git a/src/App.php b/src/App.php index a2d7d243..3a0e9a52 100755 --- a/src/App.php +++ b/src/App.php @@ -607,8 +607,14 @@ public function run(Request $request, Response $response): self return \strlen($b) - \strlen($a); }); - \uksort(self::$routes[$method], function (string $a, string $b) { - return \count(\explode('/', $b)) - \count(\explode('/', $a)); + \uksort(self::$routes[$method], function ($a, $b) { + $result = \count(\explode('/', $b)) - \count(\explode('/', $a)); + + if($result === 0) { + return \substr_count($a, ':') - \substr_count($b, ':'); + } + + return $result; }); }