A simple question, PHP 8.x from now not supporting FILTER_SANITIZE_STRING,
'FILTER_SANITIZE_STRING' is deprecated.
Should i replace it with:
htmlspecialchars() // Already by default charset UTF-8
What i need:
- protect from XSS, where FILTER_SANITIZE_STRING removing <in between>.
- It's ok if client signed up with <script>....(anyName)</script>and get his name only without telling him. (Already filtered with JS but if he ignored that).
Example:
<?php
$name = htmlspecialchars($_POST['userInput']);
$stmt = $pdo->prepare("INSERT INTO ......... VALUES (:zname)");
$stmt->execute([
   ":zname" => $name
]);
Will be safe to use this example instead of filter_var($_POST['userInput'], FILTER_SANITIZE_STRING); ?
Thank you.
 
    