Skip to content

Commit 5b695a5

Browse files
committed
Drop deprecated FILTER_SANITIZE_STRIPPED type
The `FILTER_SANITIZE_STRIPPED` type for `filter_var()` is deprecated as of PHP 8.1, `htmlspecialchars()` should be used instead.
1 parent 9bcc481 commit 5b695a5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Classes/Controller/CommentController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ public function createAction(NodeInterface $postNode, NodeTemplate $newComment):
6666
$this->throwStatus(400, 'Your comment was NOT created - it was too short.');
6767
}
6868

69-
$newComment->setProperty('text', filter_var($newComment->getProperty('text'), FILTER_SANITIZE_STRIPPED));
70-
$newComment->setProperty('author', filter_var($newComment->getProperty('author'), FILTER_SANITIZE_STRIPPED));
71-
$newComment->setProperty('emailAddress', filter_var($newComment->getProperty('emailAddress'), FILTER_SANITIZE_STRIPPED));
69+
$newComment->setProperty('text', htmlspecialchars($newComment->getProperty('text')));
70+
$newComment->setProperty('author', htmlspecialchars($newComment->getProperty('author')));
71+
$newComment->setProperty('emailAddress', htmlspecialchars($newComment->getProperty('emailAddress')));
7272

7373
$commentNode = $postNode->getNode('comments')->createNodeFromTemplate($newComment, uniqid('comment-', true));
7474
$commentNode->setProperty('spam', false);

0 commit comments

Comments
 (0)