Commit 1d95dcbf authored by drumm's avatar drumm

#91624 by chx and RobRoy. PHP has an inconsistentcy about magic quoting which...

#91624 by chx and RobRoy. PHP has an inconsistentcy about magic quoting which we have to work around.
parent 7fb6b1ac
......@@ -555,6 +555,24 @@ function _fix_gpc_magic(&$item) {
}
}
/**
* Helper function to strip slashes from $_FILES skipping over the tmp_name keys
* since PHP generates single backslashes for file paths on Windows systems.
*
* tmp_name does not have backslashes added see
* http://php.net/manual/en/features.file-upload.php#42280
*/
function _fix_gpc_magic_files(&$item, $key) {
if ($key != 'tmp_name') {
if (is_array($item)) {
array_walk($item, '_fix_gpc_magic_files');
}
else {
$item = stripslashes($item);
}
}
}
/**
* Correct double-escaping problems caused by "magic quotes" in some PHP
* installations.
......@@ -566,7 +584,7 @@ function fix_gpc_magic() {
array_walk($_POST, '_fix_gpc_magic');
array_walk($_COOKIE, '_fix_gpc_magic');
array_walk($_REQUEST, '_fix_gpc_magic');
array_walk($_FILES, '_fix_gpc_magic');
array_walk($_FILES, '_fix_gpc_magic_files');
$fixed = TRUE;
}
}
......
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