Ajoute la validation pour les commentaires
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user