From b930c06683c13f53caa2d60b71629dc4f59e4781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Fri, 20 Nov 2015 07:17:49 +0100 Subject: [PATCH] [BUGFIX] Fixed support for urls like /path/{param}/path --- src/Pecee/SimpleRouter/RouterRoute.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Pecee/SimpleRouter/RouterRoute.php b/src/Pecee/SimpleRouter/RouterRoute.php index c946e22..2a312b1 100644 --- a/src/Pecee/SimpleRouter/RouterRoute.php +++ b/src/Pecee/SimpleRouter/RouterRoute.php @@ -42,12 +42,15 @@ class RouterRoute extends RouterEntry { $url = parse_url($request->getUri()); $url = $url['path']; - $route = $this->url; + $route = rtrim($this->url, '/') . '/'; $routeMatch = preg_replace('/\/{0,1}'.self::PARAMETERS_REGEX_MATCH.'\/{0,1}/is', '', $route); + $tmp = explode('/', $route); + $tmp2 = explode('/', $url); + // Check if url parameter count matches - if(stripos($url, $routeMatch) === 0) { + if(stripos($url, $routeMatch) === 0 || count($tmp) === count($tmp2)) { $matches = true;