From 9bb6878fbc6d5ca8094cb32eb950c035493b443d Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 19 May 2018 09:42:55 +0200 Subject: [PATCH] Add missing value validation in `TSelectionFormField` See #2509 --- .../form/builder/field/TSelectionFormField.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TSelectionFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TSelectionFormField.class.php index 3487cdbbb8..24d13501cd 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TSelectionFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TSelectionFormField.class.php @@ -149,4 +149,15 @@ trait TSelectionFormField { parent::validate(); } + + /** + * @inheritDoc + */ + public function value($value): IFormField { + if (!in_array($value, $this->possibleValues)) { + throw new \InvalidArgumentException("Unknown value '{$value}'"); + } + + return parent::value($value); + } } -- 2.20.1