Commit ec2fc6dd authored by Taylor Otwell's avatar Taylor Otwell

fixed infinite loop when removing magic.

parent bf509b67
...@@ -97,7 +97,7 @@ function array_set(&$array, $key, $value) ...@@ -97,7 +97,7 @@ function array_set(&$array, $key, $value)
// If the key doesn't exist at this depth, we will just create an // 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 // 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])) if ( ! isset($array[$key]) or ! is_array($array[$key]))
{ {
$array[$key] = array(); $array[$key] = array();
...@@ -197,10 +197,10 @@ function array_spin($array, $callback) ...@@ -197,10 +197,10 @@ function array_spin($array, $callback)
*/ */
function array_strip_slashes($array) function array_strip_slashes($array)
{ {
$result = array();
foreach($array as $key => $value) foreach($array as $key => $value)
{ {
unset($array[$key]);
$key = stripslashes($key); $key = stripslashes($key);
// If the value is an array, we will just recurse back into the // If the value is an array, we will just recurse back into the
...@@ -208,15 +208,15 @@ function array_strip_slashes($array) ...@@ -208,15 +208,15 @@ function array_strip_slashes($array)
// otherwise we will set the stripped value. // otherwise we will set the stripped value.
if (is_array($value)) if (is_array($value))
{ {
$array[$key] = array_strip_slashes($value); $result[$key] = array_strip_slashes($value);
} }
else else
{ {
$array[$key] = stripslashes($value); $result[$key] = stripslashes($value);
} }
} }
return $array; return $result;
} }
/** /**
......
...@@ -67,9 +67,12 @@ ini_set('display_errors', 'Off'); ...@@ -67,9 +67,12 @@ ini_set('display_errors', 'Off');
*/ */
if (magic_quotes()) 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);
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment