From: Matthias Schmidt Date: Sat, 19 May 2018 07:42:55 +0000 (+0200) Subject: Add missing value validation in `TSelectionFormField` X-Git-Tag: 5.2.0_Alpha_1~680^2~54 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9bb6878fbc6d5ca8094cb32eb950c035493b443d;p=GitHub%2FWoltLab%2FWCF.git Add missing value validation in `TSelectionFormField` See #2509 --- 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); + } }