From 88fa724146a172e28bbf1540fdb1ac1671ffaa55 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 6 Apr 2019 12:19:35 +0200 Subject: [PATCH] Fix validation of non-required user form field allowing multiple values See #2509 --- .../system/form/builder/field/user/UserFormField.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/form/builder/field/user/UserFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/user/UserFormField.class.php index fe086e60be..d52214a1ad 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/user/UserFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/user/UserFormField.class.php @@ -63,7 +63,12 @@ class UserFormField extends AbstractFormField implements IAutoFocusFormField, II * @inheritDoc */ public function validate() { - if ($this->isRequired() && ($this->getValue() === null || $this->getValue() === '') || (is_array($this->getValue()) && empty($this->getValue()))) { + if ( + $this->isRequired() && ( + ($this->getValue() === null || $this->getValue() === '') || + (is_array($this->getValue()) && empty($this->getValue())) + ) + ) { $this->addValidationError(new FormFieldValidationError('empty')); } else if (!$this->isRequired()) { -- 2.20.1