I’ve found an article claiming that $_SERVER['PHP_SELF'] is vulnerable to XSS.
I’m not sure if I have understood it correctly, but I’m almost sure that it’s wrong.
How can this be vulnerable to XSS attacks!?
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<!-- form contents -->
</form>
To make it safe to use you need to use
htmlspecialchars().See A XSS Vulnerability in Almost Every PHP Form I’ve Ever Written for how
$_SERVER["PHP_SELF"]can be attacked.