=== modified file 'sites/all/modules/filefield/field_file.inc' --- sites/all/modules/filefield/field_file.inc 2010-07-01 14:24:51 +0000 +++ sites/all/modules/filefield/field_file.inc 2010-07-28 19:14:45 +0000 @@ -156,7 +156,13 @@ // Call the validation functions. $errors = array(); foreach ($validators as $function => $args) { - array_unshift($args, $file); + // We have to pass $file as a reference (because call_user_func_array() + // ignores function definitions; it's the only function where we must use + // call-time pass-by-reference). + // Since we cannot safely use call-time references anywhere else + // (including array_unshift), we do it like this: + array_unshift($args, NULL); + $args[0] = &$file; $errors = array_merge($errors, call_user_func_array($function, $args)); }