I am getting the following error only when I enable Filefield Meta:

warning: array_merge() [function.array-merge]: Argument #2 is not an array in C:\xampp\htdocs\mysite\sites\all\modules\contrib\filefield\filefield_field.inc on line 309.

As you can see from the path, my install is local (xampp). Any help debugging this would be appreciated.

CommentFileSizeAuthor
#12 filefield-1180508-12.patch535 bytesmikeytown2
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xjm’s picture

I have a similar error in 6.x-3.10 with FileField and FileField Meta enabled. The error appears on a view that includes links to documents, but only with a certain argument.

warning: array_merge() [function.array-merge]: Argument #2 is not an array in /var/www/dfm/htdocs/drupal-6.19/sites/all/modules/filefield/filefield_formatter.inc on line 61.

bomarmonk’s picture

I managed to get rid of my error only after deleting all filefield content through Drupal's content editing. I had to basically rebuild all content that included a filefield :(

xjm’s picture

That's not an option for me, as I have thousands upon thousands of nodes with filefield content. Surely there's an easier way to fix this error message? It could be as simple as if is_array($foo){ }, or maybe detecting and correcting whatever missing array data before it gets to that point.

bomarmonk’s picture

Somewhere I saw a post suggesting to set reporting from php or apache to be less strict; thus hiding these warning reports. If everything is working, maybe that's a solution. I didn't like it though; I wanted to get rid of the bad data, or whatever.

gandhiano’s picture

Same problem here, subscribing. I think it is related to what is said here: http://drupal.org/node/791118#comment-3949114 - something wrong with a late activation of FileField Meta. In my case, this happened as a consequence of an upgrade of an old drupal 5 website

labopen.ti’s picture

adding (array) at line 309 should solve the problem

// Load the complete file if a filepath is not available.
if (!empty($item['fid']) && empty($item['filepath'])) {
$file = (array) field_file_load($item['fid']);
if (isset($file['data'])) {
$file['data'] = array_merge($file['data'], (array) $items[$delta]['data']);
}
$items[$delta] = array_merge($file, $items[$delta]);
}

Ayesh’s picture

#6 worked!
Thank you.

xjm’s picture

Re: #6. Cool! You should make a patch so the maintainer can review it. :)

drupalnesia’s picture

Title: Warning Array Merge Error » Warning Array Merge Error while Filefield Meta Enable
guvser’s picture

Please delete this post.

ShadowCaster’s picture

I encountered this problem as well. The change above in #6 solved the problem for me too. I'm running filefield 6.x-3.10.

Mike S

mikeytown2’s picture

Version: 6.x-3.10 » 6.x-3.x-dev
Status: Active » Needs review
FileSize
535 bytes

Here is a patch that fixes this error

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in filefield_widget() (line 319 of filefield/filefield.module).

maggie_au’s picture

Thanks for Comment #6, it works~~~

quicksketch’s picture

@mikeytown2: A patch that solves the problem your patch fixes has been committed separately in #1171760: warning: array_merge() [function.array-merge]: Argument #2 is not an array when using CCK 3.x. Not sure if that's actually related to the FileField Meta issue others are describing here though.

quicksketch’s picture

Status: Needs review » Closed (duplicate)

Hm, the lines described in #6 no longer exist, they're replaced with the ones we fixed in that other issue, so seems like this has been fixed and this is a duplicate.

loparr’s picture

Issue summary: View changes

Ok, I am experiencing same issue as #1. Same problem is on line 61. I have last version installed.