From cc7fb69a31bedf360d9070b9b2f86d3495dde0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E9=87=91=E5=8B=87?= Date: Mon, 22 Dec 2025 14:39:02 +0800 Subject: [PATCH] * [apiv2] Check bug exists. --- module/bug/control.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/module/bug/control.php b/module/bug/control.php index 5c161f2d43..94fabfb9a9 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -310,6 +310,8 @@ class bug extends control public function edit(int $bugID, bool $comment = false) { $oldBug = $this->bug->getByID($bugID); + if(!$oldBug) return $this->send(array('result' => 'fail', 'message' => $this->lang->bug->error->notExist)); + if(!empty($_POST)) { $formData = form::data($this->config->bug->form->edit, $bugID); @@ -352,6 +354,7 @@ class bug extends control /* 获取更新前的 bug,并且检查所属执行的权限。*/ /* Get old bug and check privilege of the execution. */ $oldBug = $this->bug->getByID($bugID); + if(!$oldBug) return $this->send(array('result' => 'fail', 'message' => $this->lang->bug->error->notExist)); $this->bugZen->checkBugExecutionPriv($oldBug); if(!empty($_POST)) @@ -404,6 +407,7 @@ class bug extends control public function confirm(int $bugID, string $kanbanParams = '', string $from = '') { $oldBug = $this->bug->getByID($bugID); + if(!$oldBug) return $this->send(array('result' => 'fail', 'message' => $this->lang->bug->error->notExist)); /* 检查 bug 所属执行的权限。*/ /* Check privilege for execution of the bug. */ @@ -454,6 +458,7 @@ class bug extends control /* 获取 bug 信息,并检查 bug 所属执行的权限。*/ /* Get bug info, and check privilege of bug 所属执行的权限。*/ $oldBug = $this->bug->getById($bugID); + if(!$oldBug) return $this->send(array('result' => 'fail', 'message' => $this->lang->bug->error->notExist)); $this->bugZen->checkBugExecutionPriv($oldBug); if(!empty($_POST)) @@ -529,6 +534,7 @@ class bug extends control /* 获取 bug 信息,并检查 bug 所属执行的权限。*/ /* Get bug info, and check privilege of bug 所属执行的权限。*/ $oldBug = $this->bug->getByID($bugID); + if(!$oldBug) return $this->send(array('result' => 'fail', 'message' => $this->lang->bug->error->notExist)); $this->bugZen->checkBugExecutionPriv($oldBug); if(!empty($_POST)) @@ -586,6 +592,7 @@ class bug extends control /* 获取 bug 信息,并检查 bug 所属执行的权限。*/ /* Get bug info, and check privilege of bug 所属执行的权限。*/ $oldBug = $this->bug->getByID($bugID); + if(!$oldBug) return $this->send(array('result' => 'fail', 'message' => $this->lang->bug->error->notExist)); $this->bugZen->checkBugExecutionPriv($oldBug); if(!empty($_POST)) @@ -629,6 +636,8 @@ class bug extends control /* 删除 bug。 */ /* Delete bug. */ $bug = $this->bug->getByID($bugID); + if(!$bug) return $this->send(array('result' => 'fail', 'message' => $this->lang->bug->error->notExist)); + $this->bug->delete(TABLE_BUG, $bugID); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));