From a2a9ef847afee22b566f0e76d7790283ad58a318 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 15 Apr 2018 16:25:23 +0200 Subject: [PATCH] Abort field validation after first validation error See #2509 --- .../form/builder/field/AbstractFormField.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/system/form/builder/field/AbstractFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/AbstractFormField.class.php index b134dd8c51..9dcbb17fff 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/AbstractFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/AbstractFormField.class.php @@ -239,8 +239,14 @@ abstract class AbstractFormField implements IFormField { * @inheritDoc */ public function validate() { - foreach ($this->getValidators() as $validator) { - $validator($this); + if (empty($this->getValidationErrors())) { + foreach ($this->getValidators() as $validator) { + $validator($this); + + if (!empty($this->getValidationErrors())) { + break; + } + } } } } -- 2.20.1