Most recent version of drupal core dev results in an AJAX http error when using file fields mapping. The exact error in dblog is:
Recoverable fatal error: Argument 2 passed to token_replace() must be an array, object given, called in /var/aegir/drupal7/modules/file/file.field.inc on line 581 and defined in token_replace() (line 76 of /var/aegir/drupal7/includes/token.inc).
The quick fix to get functional feeds back is to swap the new file_field_widget_uri function in the above mentioned file.field.inc back to the previous as below. Not quite sure where the error is (as I am using filefield_sources also), but this will get feeds back online for now.
function file_field_widget_uri($field, $instance, $account = NULL) {
$destination = trim($instance['settings']['file_directory'], '/');
// Replace tokens.
$data = array('user' => isset($account) ? $account : $GLOBALS['user']);
$destination = token_replace($destination, $data);
return $field['settings']['uri_scheme'] . '://' . $destination;
}
Comments
Comment #1
Anonymous (not verified) commentedI experienced this same thing, as exposed through the Feeds module (http://drupal.org/node/1169986). This fix took care of the issue for me.
Comment #2
bcostlow commentedFeeds calls file_field_widget_uri() in mappers/file.inc (Line 69) which is causing this AJAX error.
Replace with:
which preserves the functionality of the old file_field_widget_uri() and prevents the AJAX error.
Comment #3
glottus commentedsubscribing
Comment #4
wojtha commentedI don't think that we should assign the authorship of the entity to the current user if no entity UID exist. Better fallback will be assign the entity to anonymous user. We probably also want to check if the account really exists or we get FALSE from the user_load() which will cause same error in token_replace() as the NULL.
Comment #5
wojtha commentedSorry, empty patch.
Comment #6
wojtha commentedSorry for the second empty patch, I unwittingly post the previous form from the browser history... omg.
I just wanted to change the title, patch in #5 still applies.
Comment #7
thill_ commentedfixed with #1134684: file_field_widget_uri inappropriate $account variable