fixed infinite loop when removing magic.
This commit is contained in:
parent
bf509b679f
commit
ec2fc6ddd0
|
@ -97,7 +97,7 @@ function array_set(&$array, $key, $value)
|
|||
|
||||
// If the key doesn't exist at this depth, we will just create an
|
||||
// empty array to hold the next value, allowing us to create the
|
||||
// arrays necessary to hold the final value at the proper depth.
|
||||
// arrays to hold the final value at the proper depth.
|
||||
if ( ! isset($array[$key]) or ! is_array($array[$key]))
|
||||
{
|
||||
$array[$key] = array();
|
||||
|
@ -197,10 +197,10 @@ function array_spin($array, $callback)
|
|||
*/
|
||||
function array_strip_slashes($array)
|
||||
{
|
||||
$result = array();
|
||||
|
||||
foreach($array as $key => $value)
|
||||
{
|
||||
unset($array[$key]);
|
||||
|
||||
$key = stripslashes($key);
|
||||
|
||||
// If the value is an array, we will just recurse back into the
|
||||
|
@ -208,15 +208,15 @@ function array_strip_slashes($array)
|
|||
// otherwise we will set the stripped value.
|
||||
if (is_array($value))
|
||||
{
|
||||
$array[$key] = array_strip_slashes($value);
|
||||
$result[$key] = array_strip_slashes($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$array[$key] = stripslashes($value);
|
||||
$result[$key] = stripslashes($value);
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,9 +67,12 @@
|
|||
*/
|
||||
if (magic_quotes())
|
||||
{
|
||||
$magic = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
|
||||
$magics = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
|
||||
|
||||
array_walk($magic, 'array_strip_slashes');
|
||||
foreach ($magics as &$magic)
|
||||
{
|
||||
$magic = array_strip_slashes($magic);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue