From f104171f2fa56f0d18ad45bfe9bd5742c9a93a28 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 27 Jun 2020 18:22:46 +0200 Subject: [PATCH] Fix validation of url form field value Close #3390 --- .../lib/system/form/builder/field/UrlFormField.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/form/builder/field/UrlFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/UrlFormField.class.php index cf94b020b0..7f56e0b0fc 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/UrlFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/UrlFormField.class.php @@ -8,7 +8,7 @@ use wcf\util\Url; * Implementation of a form field to enter a url. * * @author Matthias Schmidt - * @copyright 2001-2019 WoltLab GmbH + * @copyright 2001-2020 WoltLab GmbH * @license GNU Lesser General Public License * @package WoltLabSuite\Core\System\Form\Builder\Field * @since 5.2 @@ -19,6 +19,9 @@ class UrlFormField extends TextFormField { */ protected function validateText($text, Language $language = null) { if ($this->isRequired() && ($this->getValue() === null || $this->getValue() === '')) { + $this->addValidationError(new FormFieldValidationError('empty')); + } + else if ($this->getValue() !== null && $this->getValue() !== '') { if (!Url::is($text)) { $this->addValidationError(new FormFieldValidationError( 'invalid', -- 2.20.1