What potential issues can arise when using $PHP_SELF in PHP scripts?

Using $PHP_SELF in PHP scripts can pose a security risk as it can be manipulated by attackers to execute malicious code or perform unauthorized actions. To mitigate this risk, it is recommended to use $_SERVER['PHP_SELF'] instead, as it provides the same functionality but is more secure.

$php_self = htmlentities($_SERVER['PHP_SELF']);