Hello everybody

After the ultimate update (6.3.6, Jun-30), i have this message on all pages of my site :

warning: array_merge() [function.array-merge]: Argument #1 is not an array in /var/www/vhosts/mysite.re/httpdocs/sites/all/modules/filefield/filefield_field.inc on line 292.

An idea ?

ps: sorry, it's difficult for me to write in english

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Priority: Critical » Normal
Status: Active » Needs review
FileSize
746 bytes

Dang, well that's unfortunate. You're probably experiencing this problem either because A) you're showing files in a view or B) you've still got semi-corrupted data from the long-ago solve issue #407446: Per-Field to Per-Type Storage Corrupts Serialized Columns.

You can try out this patch to solve the problem.

whitespirit’s picture

Excellent, it's work ! Yes i use a view A) ! Thanks a lot !!! Big Kiss !

braindrift’s picture

Hi, i would suggest to do the same on line 294 (filefield_field.inc)
old: $items[$delta] = array_merge($item, $file);
new: $items[$delta] = array_merge($items[$delta], $file);

After that changes it works for me too.

Thanks.

quicksketch’s picture

FileSize
854 bytes

Thanks dendie! Here we are with that included change.

AntiNSA’s picture

i having the exact same problem warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/cyberfan/htdocs/sites/all/modules/filefield/filefield_field.inc on line 292.

Ill try the patch now////

harcher’s picture

Works for me thanks. I applied the patch to 6.x-3.6

parasox’s picture

Thank you, the second patch seems to have worked fine for me, errors are gone.

Also affected me after the 3.6 update.

AntiNSA’s picture

worked for me...

threexk’s picture

Subscribe. Curious whether this will lead to another release.

http://3281d.com/2009/03/27/death-to-subscribe-comments

eule’s picture

works for me

quicksketch’s picture

Curious whether this will lead to another release.

Yes. :-(

Please let me know if you find ANY other problems after applying this patch.

quicksketch’s picture

FileSize
845 bytes

I've updated the patch to solve the issue in #841856: Generic field used in views doesn't display 'description' also.

quicksketch’s picture

Status: Needs review » Fixed

I've committed this patch. I'll put out yet another release after resolving #841318: Links to nodes lost after upgrading to 6.x-3.6 and #842078: Linked to node defaults to frontpage.

quicksketch’s picture

Version 3.7 is now available. Sorry for the troubles everyone.

Poieo’s picture

I've updated to version 3.7, but I'm still receiving the error in the original post. Any ideas? I have run update.php.

quicksketch’s picture

@Poieo, make sure you delete any stray copies of filefield from your site. Drupal will find the module no matter where you've put it (i.e. filefield.bak/filefield.module, old/filefield/filefield.module, etc.) You can check the "system" database table to check which copy of FileField Drupal is picking up.

Poieo’s picture

Drupal is pulling the 3.7 version of filefield. I checked the system table and the error is giving the exact URL to the .inc file it's pulling. I double checked that file and it is the updated version...

threexk’s picture

Poeio: Did you clear your cache? (Go to Administer->Performance, click 'Clear cached data'.)

I got an error initially about edit_access or something, but once I cleared the cache, no more errors.

Poieo’s picture

I did several times. Thanks for the idea though...

Very strange. Why would I still be getting the error when it's pulling the correct file? It doesn't seem possible that it could be pulling the updated file, but all the signs indicate that it is.

threexk’s picture

Poeio: You could take the site offline, delete the filefield directory, then clear the cache. If you still get the same error then, that means the module is being loaded from elsewhere. If not, then you could redownload and re-extract the FileField release, and see if that helps.

Poieo’s picture

Again, thanks for the idea, but still no luck. I have deleted the module files, downloaded and re-uploaded the 3.7 release, cleared all the cache files, and still receive the following error:

warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/toddler/public_html/redesign/sites/all/modules/filefield/filefield_field.inc on line 292.

The URL in the error is the exact location of the new module files I have just uploaded...

quicksketch’s picture

I think threexk's suggest is a good one. Delete the module entirely (don't reupload it), clear your caches and see if the FileField (and the error) still exist. All signs seem to point to a failure of the module update taking effect.

Poieo’s picture

I did in fact delete the module folder before my last post, cleared my caches, and still getting the error.

Thanks for your help so far.

threexk’s picture

Poeio: I think the question is, do you still get the error when you have deleted the module's directory and cleared the cache? What happens when the module's files aren't there?

Poieo’s picture

Sorry. I see now what quicksketch was asking. I deleted the module folder, cleared the cache, and the error is gone. Obviously all my fields are gone as well, but that's a given.

quicksketch’s picture

Okay so here's the affected segment of code:

291 	 if (isset($file['data'])) {
292 	$file['data'] = array_merge($items[$delta]['data'], $file['data']);
293 	}

So the first argument is $items[$delta]['data']. This data should always exist, but it's possible that content you created, edited, and then resaved while running the 3.6 version may have deleted the data entirely. Does the error occur for new content on the site, or just some of the existing content? If the error only exists on certain nodes, I'd suggest editing the node and resaving it.

Poieo’s picture

To make a long story short, that was it...

A little background in case someone else comes across this issue. The nodes on this site were transferred via phpmyadmin from a D5 site. When I started getting the error, it was only on the home page and certain views pages, not on any nodes. I had several variations of the same view all displaying a different ubercart product type. Some of the views worked, some did not and returned page not found.

As it turns out, the views that did not work had products in them that had not been edited and re-saved since the data transfer. Once I edited all the products in that view, the error was gone and the view worked correctly.

Thanks again for all your help!

quicksketch’s picture

Phew! Thank goodness. Thanks for the update Poieo.

aangel’s picture

Whew. I had 300 nodes that were affected by this. Manually re-saving them wasn't appealing in the least.

However, views bulk operations enabled me to re-save each node with Drupal doing all the work instead of me. The error is now gone and the view works again.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

grincon’s picture

I used this code to find the offending node(s):

289    if (!empty($item['fid']) && empty($item['filepath'])) {
290      $file = (array) field_file_load($item['fid']);
291      if (isset($file['data'])) {
292        if (is_array($items[$delta]['data'])) { 
...        $file['data'] = array_merge($items[$delta]['data'], $file['data']);
...        }
...        else {
...        watchdog('filefield', 'FileField working on a non array : %arr', array('%arr' => print_r($items[$delta],true)), WATCHDOG_WARNING);
...        }
...      }
...      $items[$delta] = array_merge($items[$delta], $file);
...    }

I opened the node(s), resaved them and problem was gone. Then I removed my lines from the module code to keep it clean.

I hope it helps

+German
htp://www.colomsoft.com

Desertgirl’s picture

I had the same error and the solution in #29 solved the issue!! THANK YOU!!

My situation was not an upgrade from D5 to D6. Not sure why it appeared, but so grateful for the resolution.

Cheers!

ccshannon’s picture

The problem for me is, I'm importing files and generating node content using a PHP script. When I go to my content view, which is a Views Bulk Operations view, which I have showing the images, I get these filefield errors mentioned above.

If I reload the View, I get WSOD.

Re-saving the nodes is not an acceptable solution for my client. There is no site admin day to day on his site, and I'm not going to tell my client he has to take extra steps to remove a blaring red bug every time he sends content to the system.

I'm wondering if I run a node_save on my imported nodes at the end of my import script, would that fix the issue. I will try it. Not very efficient, btw, but maybe that works to prevent this error.

I'm using latest and greatest Filefield, so the patched version doesn't help me.

Otherwise I need to hack fielfield to convert that non-array into an array, which I also don't want to do.

ju.ri’s picture

I am getting this error for certain mp3 files, on newly created nodes. The error messages appear only on view pages. Could it be something with metadata? I will post back when have more details.

ju.ri’s picture

ok I solved it by transcoding the mp3 file, stripping the metadata, re-uploading... error disappeared.