Foreach removal of Magic Quotes PHP I'm looking to remove all magic quotes at the start of my PHP script (if they are turned on). The code I'm using to do this is rather simple, so I was wondering if I was overlooking anything:

if (get_magic_quotes_gpc())
{
    foreach ($_GET as $key =&gt; $value)
        $_GET[$key] = stripslashes($value);

    foreach ($_REQUEST as $key =&gt; $value)
        $_REQUEST[$key] = stripslashes($value);

    foreach ($_POST as $key =&gt; $value)
        $_POST[$key] = stripslashes($value);

    foreach ($_COOKIE as $key =&gt; $value)
        $_COOKIE[$key] = stripslashes($value);
}


Am I missing / overlooking anything? Thanks.
If you are sanitizing your input just for the sake of sanitizing your input, you're wasting time (both yours in coding and the computer in execution). Do you need to sanitize $_COOKIE if you never use it? What about $_SESSION?

Only sanitize what you need, when you need it. Switching to a PDO system to have it sanitize your database queries would solve that aspect (and the #1 reason to sanitize).