Skip to content

Commit

Permalink
prevent multiple entries of same methode
Browse files Browse the repository at this point in the history
  • Loading branch information
papparazzo committed Jun 22, 2023
1 parent 8298785 commit 40ed473
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Slim/Routing/FastRouteDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,20 @@ public function getAllowedMethods(string $uri): array
return $this->allowedMethods[$uri];
}

$this->allowedMethods[$uri] = [];
$allowedMethods = [];
foreach ($this->staticRouteMap as $method => $uriMap) {
if (isset($uriMap[$uri])) {
$this->allowedMethods[$uri][] = $method;
$allowedMethods[$method] = true;
}
}

foreach ($this->variableRouteData as $method => $routeData) {
$result = $this->dispatchVariableRoute($routeData, $uri);
if ($result[0] === self::FOUND) {
$this->allowedMethods[$uri][] = $method;
$allowedMethods[$method] = true;
}
}

return $this->allowedMethods[$uri];
return $this->allowedMethods[$uri] = array_keys($allowedMethods);
}
}

0 comments on commit 40ed473

Please sign in to comment.