From f55041bd8ca902548fdf9141d01198d598822edf Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 3 Jul 2024 14:42:55 +0200 Subject: [PATCH] Limit contact.contact_address to 255 chars --- library/Notifications/Web/Form/ContactForm.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/Notifications/Web/Form/ContactForm.php b/library/Notifications/Web/Form/ContactForm.php index 980a30231..e97e1cfd9 100644 --- a/library/Notifications/Web/Form/ContactForm.php +++ b/library/Notifications/Web/Form/ContactForm.php @@ -287,7 +287,11 @@ private function addAddressElements(): void $this->addElement($address); foreach ($plugins as $type => $label) { - $element = $this->createElement('text', $type, ['label' => $label]); + $element = $this->createElement('text', $type, [ + 'label' => $label, + 'validators' => [new StringLengthValidator(['max' => 255])] + ]); + if ($type === 'email') { $element->addAttributes(['validators' => [new EmailAddressValidator()]]); }