diff --git a/src/Silex/Validation/CommentValidation.php b/src/Silex/Validation/CommentValidation.php index b410175..a884329 100644 --- a/src/Silex/Validation/CommentValidation.php +++ b/src/Silex/Validation/CommentValidation.php @@ -4,7 +4,7 @@ namespace Silex\Validation; final class CommentValidation { - public static function isValidComment(array $post, bool $requiresName, array &$errors): bool + public static function isValidComment(array &$post, bool $requiresName, array &$errors): bool { if ($requiresName) { UserValidation::isValidName($post, $errors, 'name'); @@ -12,6 +12,7 @@ final class CommentValidation if (empty($post['content'])) { $errors[] = 'Empty message'; } + $post['content'] = htmlspecialchars($post['content']); return empty($errors); } }