note 76387 added to security.magicquotes
| From: | webmaster at kevinjb dot com | Date: | Thu, 12 Jul 2007 20:12:55 +0000 |
| Subject: | note 76387 added to security.magicquotes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128422@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 64.71.164.2
Probable Submitter: 71.253.206.137
----
Manual Page -- http://www.php.net/manual/en/security.magicquotes.php
Edit -- https://master.php.net/note/edit/76387
Del: integrated -- https://master.php.net/note/delete/76387/integrated
Del: useless -- https://master.php.net/note/delete/76387/useless
Del: bad code -- https://master.php.net/note/delete/76387/bad+code
Del: spam -- https://master.php.net/note/delete/76387/spam
Del: non-english -- https://master.php.net/note/delete/76387/non-english
Del: in docs -- https://master.php.net/note/delete/76387/in+docs
Del: other reasons-- https://master.php.net/note/delete/76387
Reject -- https://master.php.net/note/reject/76387
Search -- https://master.php.net/manage/user-notes.php