Closed (fixed)
Project:
Node Private File
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 May 2011 at 20:48 UTC
Updated:
10 Jun 2011 at 18:02 UTC
When putting together a fairly complicated view where there isn't always a value for the file field, I got this error:
warning: array_merge(): Argument #2 is not an array in /vol/home/4h/htdocs-dev/sites/all/modules/node_private_file/node_private_file.field_formatter.inc on line 69.
The code in question:
if (empty($item['filepath']) && !empty($item['fid'])) {
dsm($item['fid']);
$item = array_merge($item, field_file_load($item['fid']));
}
It assumes there is an FID. I changed the code so that assumption was no longer made:
if (empty($item['filepath']) && !empty($item['fid'])) {
$file = field_file_load($item['fid']);
if (is_array($file)) {
$item = array_merge($item, $file);
}
}
Comments
Comment #1
andreiashu commentedHi,
First of all sorry for the late reply but I was under the impression that being the module's maintainer d.o would send me an email automatically when someone posts an issue... Anyway, now I subscribed to the issue queue so hopefully I should get a notification from now on.
I would be interested if you could look into your database and see how is it that you can get an $item with a 'fid' parameter and at the same time field_file_load() to return FALSE.
I committed a slightly altered version of your code.
Thanks!
Comment #2
andreiashu commented