From 2cdcd0652edcfeea314099e7da015c254f78bae5 Mon Sep 17 00:00:00 2001 From: sugar1569 Date: Wed, 10 Jul 2019 11:58:57 +0800 Subject: [PATCH] =?UTF-8?q?ThinkPHP=205.0.x=20=E8=BF=9C=E7=A8=8B=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=89=A7=E8=A1=8C=E9=AB=98=E5=8D=B1=E6=BC=8F=E6=B4=9E?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- thinkphp/library/think/Request.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/thinkphp/library/think/Request.php b/thinkphp/library/think/Request.php index f6ac1ae6..b060f980 100644 --- a/thinkphp/library/think/Request.php +++ b/thinkphp/library/think/Request.php @@ -522,8 +522,14 @@ class Request return $this->server('REQUEST_METHOD') ?: 'GET'; } elseif (!$this->method) { if (isset($_POST[Config::get('var_method')])) { - $this->method = strtoupper($_POST[Config::get('var_method')]); - $this->{$this->method}($_POST); + $method = strtoupper($_POST[Config::get('var_method')]); + if (in_array($method, ['GET', 'POST', 'DELETE', 'PUT', 'PATCH'])) { + $this->method = $method; + $this->{$this->method}($_POST); + } else { + $this->method = 'POST'; + } + unset($_POST[Config::get('var_method')]); } elseif (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) { $this->method = strtoupper($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']); } else {