From 12a8671065cef107caf906c00444664081a5b90e Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 19 Oct 2020 13:56:46 +0900 Subject: [PATCH] Fix #1424 incorrect handling of multi-method (GET|POST) actions --- common/framework/parsers/moduleactionparser.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/framework/parsers/moduleactionparser.php b/common/framework/parsers/moduleactionparser.php index e693f8b9d..5dce56981 100644 --- a/common/framework/parsers/moduleactionparser.php +++ b/common/framework/parsers/moduleactionparser.php @@ -92,11 +92,11 @@ class ModuleActionParser extends BaseParser // Parse routes. $route_attr = trim($action['route']); $route_tags = $action->route ?: []; - $method = trim($action['method']); + $method_attr = trim($action['method']); + $methods = $method_attr ? explode('|', strtoupper($method_attr)) : (starts_with('proc', $action_name) ? ['POST'] : ['GET']); $route_arg = []; if ($route_attr || count($route_tags)) { - $methods = $method ? explode('|', strtoupper($method)) : (starts_with('proc', $action_name) ? ['POST'] : ['GET']); $routes = $route_attr ? array_map(function($route) { return ['route' => trim($route), 'priority' => 0]; }, explode_with_escape('|', $route_attr)) : array(); @@ -121,7 +121,7 @@ class ModuleActionParser extends BaseParser $action_info->grant = trim($action['grant']) ?: 'guest'; $action_info->permission = $permission_info; $action_info->ruleset = trim($action['ruleset']); - $action_info->method = $method; + $action_info->method = implode('|', $methods); $action_info->route = $route_arg; $action_info->standalone = trim($action['standalone']) === 'false' ? 'false' : 'true'; $action_info->check_csrf = (trim($action['check_csrf']) ?: trim($action['check-csrf'])) === 'false' ? 'false' : 'true';