Skip to content

Commit 12c32ba

Browse files
authored
Remove CLI redundancy; restore Closure check
1 parent 0d23de4 commit 12c32ba

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

system/Router/RouteCollection.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ class RouteCollection implements RouteCollectionInterface
234234
*/
235235
public function __construct(FileLocator $locator, $moduleConfig)
236236
{
237-
// Get HTTP verb
238-
$this->HTTPVerb = is_cli() ? 'cli' : Services::request()->getMethod();
237+
// Get HTTP verb from current request (accounts for spoofing)
238+
$this->HTTPVerb = Services::request()->getMethod();
239239

240240
$this->fileLocator = $locator;
241241

@@ -1116,6 +1116,12 @@ public function reverseRoute(string $search, ...$params)
11161116
{
11171117
$from = key($route['route']);
11181118
$to = $route['route'][$from];
1119+
1120+
// ignore closures
1121+
if (! is_string($to))
1122+
{
1123+
continue;
1124+
}
11191125

11201126
// Lose any namespace slash at beginning of strings
11211127
// to ensure more consistent match.

0 commit comments

Comments
 (0)