From fd8afd2b2e599895cc06269d7b7cddce006929d6 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Mon, 28 May 2018 20:13:31 +0200 Subject: [PATCH] Ignore `null` as passed value for `TSelectionFormField::value()` See #2509 --- .../system/form/builder/field/TSelectionFormField.class.php | 6 ++++++ 1 file changed, 6 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 24d13501cd..fdb25a800c 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 @@ -154,6 +154,12 @@ trait TSelectionFormField { * @inheritDoc */ public function value($value): IFormField { + // ignore `null` as value which can be passed either for nullable + // fields or as value if no options are available + if ($value === null) { + return $this; + } + if (!in_array($value, $this->possibleValues)) { throw new \InvalidArgumentException("Unknown value '{$value}'"); } -- 2.20.1