Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.537.2.9 diff -u -r1.537.2.9 common.inc --- includes/common.inc 27 Sep 2006 08:15:11 -0000 1.537.2.9 +++ includes/common.inc 27 Oct 2006 19:34:28 -0000 @@ -514,6 +514,25 @@ } /** + * Helper function to strip slashes from $_FILES on Windows skipping over the + * tmp_name values since PHP generates single backslashes for file paths. + * + * @see http://us2.php.net/manual/en/features.file-upload.php#42280 + */ +function _fix_gpc_magic_files_win(&$item) { + foreach ($item as $key => $value) { + if ($key != 'tmp_name') { + if (is_array($value)) { + _fix_gpc_magic_files_win($item[$key]); + } + else { + $item[$key] = stripslashes($value); + } + } + } +} + +/** * Correct double-escaping problems caused by "magic quotes" in some PHP * installations. */ @@ -524,7 +543,13 @@ array_walk($_POST, '_fix_gpc_magic'); array_walk($_COOKIE, '_fix_gpc_magic'); array_walk($_REQUEST, '_fix_gpc_magic'); - array_walk($_FILES, '_fix_gpc_magic'); + + if (substr(PHP_OS, 0, 3) == 'WIN') { + _fix_gpc_magic_files_win($_FILES); + } + else { + array_walk($_FILES, '_fix_gpc_magic'); + } $fixed = true; } }