You are here

function _fix_gpc_magic_files in Drupal 7

Same name and namespace in other branches
  1. 4 includes/common.inc \_fix_gpc_magic_files()
  2. 5 includes/common.inc \_fix_gpc_magic_files()
  3. 6 includes/common.inc \_fix_gpc_magic_files()

Strips slashes from $_FILES items.

Callback for array_walk() within fix_gpc_magic().

The tmp_name key is skipped keys since PHP generates single backslashes for file paths on Windows systems.

Parameters

$item: An item from $_FILES.

$key: The key for the item within $_FILES.

See also

http://php.net/manual/features.file-upload.php#42280

1 string reference to '_fix_gpc_magic_files'
fix_gpc_magic in includes/common.inc
Fixes double-escaping caused by "magic quotes" in some PHP installations.

File

includes/common.inc, line 1203
Common functions that many Drupal modules will need to reference.

Code

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);
    }
  }
}