Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#12 | filefield-1180508-12.patch | 535 bytes | mikeytown2 |
Comments
Comment #1
xjmI 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.
Comment #2
bomarmonk CreditAttribution: bomarmonk commentedI 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 :(
Comment #3
xjmThat'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.Comment #4
bomarmonk CreditAttribution: bomarmonk commentedSomewhere 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.
Comment #5
gandhiano CreditAttribution: gandhiano commentedSame 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
Comment #6
labopen.ti CreditAttribution: labopen.ti commentedadding (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]);
}
Comment #7
Ayesh CreditAttribution: Ayesh commented#6 worked!
Thank you.
Comment #8
xjmRe: #6. Cool! You should make a patch so the maintainer can review it. :)
Comment #9
drupalnesia CreditAttribution: drupalnesia commentedComment #10
guvser CreditAttribution: guvser commentedPlease delete this post.
Comment #11
ShadowCaster CreditAttribution: ShadowCaster commentedI 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
Comment #12
mikeytown2 CreditAttribution: mikeytown2 commentedHere 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).
Comment #13
maggie_au CreditAttribution: maggie_au commentedThanks for Comment #6, it works~~~
Comment #14
quicksketch@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.
Comment #15
quicksketchHm, 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.
Comment #16
loparr CreditAttribution: loparr commentedOk, I am experiencing same issue as #1. Same problem is on line 61. I have last version installed.