From a66a3cd448699b214142aad4ffd07d6f1d8dc2cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 4 Mar 2012 15:48:10 +0100 Subject: [PATCH] Disallow to long messages in PHP --- file/lib/form/ChatForm.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/file/lib/form/ChatForm.class.php b/file/lib/form/ChatForm.class.php index 9e7b129..4a8ec7e 100644 --- a/file/lib/form/ChatForm.class.php +++ b/file/lib/form/ChatForm.class.php @@ -54,9 +54,14 @@ public function readFormParameters() { */ public function validate() { parent::validate(); + if ($this->message === '') { throw new UserInputException('text'); } + + if (strlen($this->message) > CHAT_MAX_LENGTH) { + throw new UserInputException('text', 'tooLong'); + } } /**