[web-bugs] master: Fix the problem that undefined state status can be used
| From: | sy-records via Nikita Popov | Date: | Thu, 21 Oct 2021 10:35:34 +0000 |
| Subject: | [web-bugs] master: Fix the problem that undefined state status can be used | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-29669@lists.php.net to get a copy of this message | ||
Author: sy-records (sy-records)
Committer: Nikita Popov (nikic)
Date: 2021-10-21T12:36:12+02:00
Commit: https://github.com/php/web-bugs/commit/29b70e2986df56781b902dc51c71c2d6f85dda23
Raw diff: https://github.com/php/web-bugs/commit/29b70e2986df56781b902dc51c71c2d6f85dda23.diff
Fix the problem that undefined state status can be used
Changed paths:
M www/bug.php
Diff:
diff --git a/www/bug.php b/www/bug.php
index c49f69fc..66405fe9 100644
--- a/www/bug.php
+++ b/www/bug.php
@@ -436,8 +436,12 @@
}
}
+ global $state_types;
+ $allowed_state_types = array_filter($state_types, function ($var) {
+ return $var !== 0;
+ });
// Require comment for open bugs only
- if (empty($_POST['in']['status'])) {
+ if (empty($_POST['in']['status']) ||
!isset($allowed_state_types[$_POST['in']['status']])) {
$errors[] = "You must provide a status";
} else {
if ($_POST['in']['status'] == 'Not a bug' &&