Skip to content

Commit 3cf4c99

Browse files
authored
Merge pull request #3271 from papparazzo/prevent_multiple_entries_of_same_method
prevent multiple entries of same methode in FastRouteDispatcher
2 parents 8298785 + 40ed473 commit 3cf4c99

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Slim/Routing/FastRouteDispatcher.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,20 @@ public function getAllowedMethods(string $uri): array
9090
return $this->allowedMethods[$uri];
9191
}
9292

93-
$this->allowedMethods[$uri] = [];
93+
$allowedMethods = [];
9494
foreach ($this->staticRouteMap as $method => $uriMap) {
9595
if (isset($uriMap[$uri])) {
96-
$this->allowedMethods[$uri][] = $method;
96+
$allowedMethods[$method] = true;
9797
}
9898
}
9999

100100
foreach ($this->variableRouteData as $method => $routeData) {
101101
$result = $this->dispatchVariableRoute($routeData, $uri);
102102
if ($result[0] === self::FOUND) {
103-
$this->allowedMethods[$uri][] = $method;
103+
$allowedMethods[$method] = true;
104104
}
105105
}
106106

107-
return $this->allowedMethods[$uri];
107+
return $this->allowedMethods[$uri] = array_keys($allowedMethods);
108108
}
109109
}

0 commit comments

Comments
 (0)