Skip to content

Commit 1aef8f2

Browse files
committed
fix: cannot setting params. Sometimes 'notFound' would be considered 'notAllowed'
1 parent 56e3cea commit 1aef8f2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Router/HandlerMapping.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ protected function prepareForMap(string $route, $handler, array $opts): array
164164
protected function collectParamRoute(string $route, array $methods, array $conf)
165165
{
166166
$conf['original'] = $route;
167-
$params = $this->getAvailableParams($opts['params'] ?? []);
167+
$params = $this->getAvailableParams($conf['option']['params'] ?? []);
168168
list($first, $conf) = $this->parseParamRoute($route, $params, $conf);
169169

170170
// route string have regular
@@ -366,7 +366,10 @@ protected function findInRegularRoutes(array $routesData, string $path, string $
366366
}
367367
}
368368

369-
return [self::NOT_FOUND, \explode(',', \trim($allowedMethods, ','))];
369+
return [
370+
self::NOT_FOUND,
371+
$allowedMethods ? \explode(',', \rtrim($allowedMethods, ',')) : []
372+
];
370373
}
371374

372375
/**

0 commit comments

Comments
 (0)