From: Matthias Schmidt Date: Sat, 6 Apr 2019 10:19:35 +0000 (+0200) Subject: Fix validation of non-required user form field allowing multiple values X-Git-Tag: 5.2.0_Alpha_1~167 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=88fa724146a172e28bbf1540fdb1ac1671ffaa55;p=GitHub%2FWoltLab%2FWCF.git Fix validation of non-required user form field allowing multiple values See #2509 --- 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()) {