note 82524 modified in function.get-magic-quotes-gpc by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 00:07:37 +0000 |
| Subject: | note 82524 modified in function.get-magic-quotes-gpc by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141826@lists.php.net to get a copy of this message | ||
@ dot dot dot dot dot alexander at gmail dot com
I suggest replacing foreach by "stripslashes_deep":
Example #2 Using stripslashes() on an array on
<http://www.php.net/manual/en/function.stripslashes.php>:
<?php
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
?>
This gives:
<?php
if((function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc()) ||
(ini_get('magic_quotes_sybase') &&
(strtolower(ini_get('magic_quotes_sybase'))!="off")) ){
stripslashes_deep($_GET);
stripslashes_deep($_POST);
stripslashes_deep($_COOKIE);
}
?>
--was--
@ dot dot dot dot dot alexander at gmail dot com
I suggest replacing foreach by "stripslashes_deep":
Example #2 Using stripslashes() on an array on
<http://www.php.net/manual/en/function.stripslashes.php>:
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
This gives:
if ( (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc())
|| (ini_get('magic_quotes_sybase') &&
(strtolower(ini_get('magic_quotes_sybase'))!="off")) )
{
stripslashes_deep($_GET);
stripslashes_deep($_POST);
stripslashes_deep($_COOKIE);
}
http://php.net/manual/en/function.get-magic-quotes-gpc.php