note 76387 deleted from security.magicquotes by philip
| From: | philip@php.net | Date: | Sun, 21 Dec 2008 01:07:43 +0000 |
| Subject: | note 76387 deleted from security.magicquotes by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-148392@lists.php.net to get a copy of this message | ||
Note Submitter: webmaster at kevinjb dot com
----
In response to jfrim at idirect dot com and the poster at 17-Jan-2007 09:37:
Here's the code I use:
<?php
if (get_magic_quotes_gpc()) {
function stripslashes_array($array) {
return is_array($array) ? array_map('stripslashes_array', $array) :
stripslashes($array);
}
$_COOKIE = stripslashes_array($_COOKIE);
$_FILES = stripslashes_array($_FILES);
$_GET = stripslashes_array($_GET);
$_POST = stripslashes_array($_POST);
$_REQUEST = stripslashes_array($_REQUEST);
}
?>
Magic_quotes_gpc does NOT effect $_SERVER or $_ENV, I tested this myself on Windows with Apache and
PHP 5. Removing slashes from them when there were none added to begin with ruins the variables in
them!
I'm not sure at the moment whether it affects $_FILES or not, still looking into that one.