fix request query parsing

This commit is contained in:
joyqi 2024-01-25 18:43:41 +08:00
parent 25cc1ff3dc
commit 2fe1c0f26e
4 changed files with 6 additions and 6 deletions

View File

@ -187,7 +187,7 @@ class Request
}
} else {
$exists = false;
return $default;
return $value ?? $default;
}
}
@ -545,7 +545,7 @@ class Request
$validated = true;
foreach ($params as $key => $val) {
$param = $this->get($key, null, $exists);
$validated = empty($val) ? $exists : ($val == $param);
$validated = $val === '' ? $exists : ($val === $param);
if (!$validated) {
break;

View File

@ -224,7 +224,7 @@ class Edit extends Metas implements ActionInterface
$submit->input->setAttribute('class', 'btn primary');
$form->addItem($submit);
if (isset($this->request->mid) && 'insert' != $action) {
if ($this->request->is('mid') && 'insert' != $action) {
/** 更新模式 */
$meta = $this->db->fetchRow($this->select()
->where('mid = ?', $this->request->mid)

View File

@ -316,7 +316,7 @@ class Upload extends Contents implements ActionInterface
'allowFeed' => 1
];
if (isset($this->request->cid)) {
if ($this->request->is('cid')) {
$cid = $this->request->filter('int')->get('cid');
if ($this->isWriteable($this->db->sql()->where('cid = ?', $cid))) {

View File

@ -1753,7 +1753,7 @@ class XmlRpc extends Contents implements ActionInterface, Hook
throw new Exception(_t('请求的地址不存在'), 404);
}
if (isset($this->request->rsd)) {
if ($this->request->get('rsd') !== null) {
echo
<<<EOF
<?xml version="1.0" encoding="{$this->options->charset}"?>
@ -1771,7 +1771,7 @@ class XmlRpc extends Contents implements ActionInterface, Hook
</service>
</rsd>
EOF;
} elseif (isset($this->request->wlw)) {
} elseif ($this->request->get('wlw') !== null) {
echo
<<<EOF
<?xml version="1.0" encoding="{$this->options->charset}"?>