框架漏洞修复同步
parent
87e7d63c70
commit
cdec48a014
|
|
@ -682,6 +682,7 @@ class Request
|
|||
// 判断URL里面是否有兼容模式参数
|
||||
$pathinfo = $_GET[$this->config['var_pathinfo']];
|
||||
unset($_GET[$this->config['var_pathinfo']]);
|
||||
unset($this->get[$this->config['var_pathinfo']]);
|
||||
} elseif ($this->isCli()) {
|
||||
// CLI模式下 index.php module/controller/action/params/...
|
||||
$pathinfo = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : '';
|
||||
|
|
@ -702,6 +703,10 @@ class Request
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($pathinfo)) {
|
||||
unset($this->get[$pathinfo], $this->request[$pathinfo]);
|
||||
}
|
||||
|
||||
$this->pathinfo = empty($pathinfo) || '/' == $pathinfo ? '' : ltrim($pathinfo, '/');
|
||||
}
|
||||
|
||||
|
|
@ -809,9 +814,14 @@ class Request
|
|||
return $this->server('REQUEST_METHOD') ?: 'GET';
|
||||
} elseif (!$this->method) {
|
||||
if (isset($_POST[$this->config['var_method']])) {
|
||||
$this->method = strtoupper($_POST[$this->config['var_method']]);
|
||||
$method = strtolower($this->method);
|
||||
$this->{$method} = $_POST;
|
||||
$method = strtolower($_POST[$this->config['var_method']]);
|
||||
if (in_array($method, ['get', 'post', 'put', 'patch', 'delete'])) {
|
||||
$this->method = strtoupper($method);
|
||||
$this->{$method} = $_POST;
|
||||
} else {
|
||||
$this->method = 'POST';
|
||||
}
|
||||
unset($_POST[$this->config['var_method']]);
|
||||
} elseif ($this->server('HTTP_X_HTTP_METHOD_OVERRIDE')) {
|
||||
$this->method = strtoupper($this->server('HTTP_X_HTTP_METHOD_OVERRIDE'));
|
||||
} else {
|
||||
|
|
@ -1034,7 +1044,7 @@ class Request
|
|||
|
||||
protected function getInputData($content)
|
||||
{
|
||||
if (false !== strpos($this->contentType(), 'application/json') || 0 === strpos($content, '{"')) {
|
||||
if (false !== strpos($this->contentType(), 'json')) {
|
||||
return (array) json_decode($content, true);
|
||||
} elseif (strpos($content, '=')) {
|
||||
parse_str($content, $data);
|
||||
|
|
@ -1320,7 +1330,8 @@ class Request
|
|||
* @param array $data 数据源
|
||||
* @return void
|
||||
*/
|
||||
public function arrayReset(array &$data) {
|
||||
public function arrayReset(array &$data)
|
||||
{
|
||||
foreach ($data as &$value) {
|
||||
if (is_array($value)) {
|
||||
$this->arrayReset($value);
|
||||
|
|
@ -1523,7 +1534,7 @@ class Request
|
|||
*/
|
||||
public function has($name, $type = 'param', $checkEmpty = false)
|
||||
{
|
||||
if (!in_array($type, ['param', 'get', 'post', 'request', 'put', 'file', 'session', 'cookie', 'env', 'header', 'route'])) {
|
||||
if (!in_array($type, ['param', 'get', 'post', 'request', 'put', 'patch', 'file', 'session', 'cookie', 'env', 'header', 'route'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1625,6 +1636,16 @@ class Request
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前是否JSON请求
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function isJson()
|
||||
{
|
||||
return false !== strpos($this->type(), 'json');
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前是否Ajax请求
|
||||
* @access public
|
||||
|
|
|
|||
Loading…
Reference in New Issue