summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--field_file.inc5
1 files changed, 4 insertions, 1 deletions
diff --git a/field_file.inc b/field_file.inc
index 1763b44..a8b8093 100644
--- a/field_file.inc
+++ b/field_file.inc
@@ -156,7 +156,10 @@ function field_file_save_file($filepath, $validators = array(), $dest = FALSE, $
// Call the validation functions.
$errors = array();
foreach ($validators as $function => $args) {
- array_unshift($args, $file);
+ // Add the $file variable to the list of arguments and pass it by
+ // reference (required for PHP 5.3 and higher).
+ array_unshift($args, NULL);
+ $args[0] = &$file;
$errors = array_merge($errors, call_user_func_array($function, $args));
}