版本查看方法:
5.0 可在 base.php 内中查看版本号,如:define('THINK_VERSION', '5.0.23');
ThinkPHP V5.1.*及 V5.2.* 版本官方暂未发布修复版本,临时缓解方案参考如下:
5.1.x系列,编辑 library/think/Request.php 文件, 查找如下内容:
$this->method = strtoupper($_POST[$this->config['var_method']]);
$method = strtolower($this->method);
$this->{$method} = $_POST;
修改为:
$method = strtoupper($_POST[Config::get('var_method')]);
if (in_array($method, ['GET', 'POST', 'DELETE', 'PUT', 'PATCH'])) {
$method = strtolower($this->method);
$this->{$method} = $_POST;
}
5.2.x系列,编辑 src/think/Request.php文件, 查找:
$this->method = strtoupper($_POST[$this->config['var_method']]);
$method = strtolower($this->method);
unset($_POST[$this->config['var_method']]);
$this->{$method} = $_POST;
修改为:
$this->method = strtoupper($_POST[$this->config['var_method']]);
$method = strtolower($this->method);
if (in_array($method, ['GET', 'POST', 'DELETE', 'PUT', 'PATCH'])) {
unset($_POST[$this->config['var_method']]);
$this->{$method} = $_POST;
}
【备注】建议您在升级前做好数据备份工作,避免出现意外。