diff --git a/system/libs/plugins.php b/system/libs/plugins.php index 420c1cdd..c3b548dc 100644 --- a/system/libs/plugins.php +++ b/system/libs/plugins.php @@ -66,7 +66,8 @@ class Plugins { if ($method !== '*') { $methods = is_string($method) ? explode(',', $info['method']) : $method; foreach ($methods as $method) { - if (!in_array($method, ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD'])) { + $method = strtolower($method); + if (!in_array($method, ['get', 'post', 'put', 'patch', 'delete', 'head'])) { self::$warnings[] = $warningPreTitle . 'Not allowed method ' . $method . '... Disabling this route...'; } } diff --git a/system/router.php b/system/router.php index 374a53e6..115eb913 100644 --- a/system/router.php +++ b/system/router.php @@ -115,6 +115,18 @@ $dispatcher = FastRoute\cachedDispatcher(function (FastRoute\RouteCollector $r) if ($route[0] === '*') { $route[0] = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD']; } + else { + if (is_string($route[0])) { + $route[0] = explode(',', $route[0]); + } + + $toUpperCase = function(string $value): string { + return trim(strtoupper($value)); + }; + + // convert to upper case, fast-route accepts only upper case + $route[0] = array_map($toUpperCase, $route[0]); + } $aliases = [ [':int', ':string', ':alphanum'],