From 3f933418e577d7fa2ba2f4986f731d731752de7d Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 28 Feb 2021 17:03:05 +0200 Subject: [PATCH] Minor fix for routing --- src/App.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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; }); }