Skip to content

Commit 5c36e9c

Browse files
committed
Merge pull request #31 from skipperbent/development
[BUGFIX] Fixed support for urls like /path/{param}/path
2 parents 0f8bba7 + b930c06 commit 5c36e9c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Pecee/SimpleRouter/RouterRoute.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,15 @@ public function matchRoute(Request $request) {
4242
$url = parse_url($request->getUri());
4343
$url = $url['path'];
4444

45-
$route = $this->url;
45+
$route = rtrim($this->url, '/') . '/';
4646

4747
$routeMatch = preg_replace('/\/{0,1}'.self::PARAMETERS_REGEX_MATCH.'\/{0,1}/is', '', $route);
4848

49+
$tmp = explode('/', $route);
50+
$tmp2 = explode('/', $url);
51+
4952
// Check if url parameter count matches
50-
if(stripos($url, $routeMatch) === 0) {
53+
if(stripos($url, $routeMatch) === 0 || count($tmp) === count($tmp2)) {
5154

5255
$matches = true;
5356

0 commit comments

Comments
 (0)