This error occurs when a file that is listed in the FILES table, but is no longer on the file system, is referenced.

filefield_widget.inc :: filefield_widget_value()

the problem comes from not handling the case where field_file_load has returned FALSE.

suggesting the patch to handle this, which sets $file=array(), in this situation

Comments

I have the same error messages in the watchdog, not sure if I should try this patch.

I'm using Filefield + Imagefield (6.x-3.7 both) + Filefield Paths 6.x-1.4 (to arrange the files on the file system). The issue is that sometimes the images uploaded with Imagefiled widget and then inserted into FCKeditor using the Automatic style of the Insert module just disappear after saving the node edit form (both from the view node and the files uploaded in the node edit form).

It all worked just fine in the past (3-4 months ago)... but we are having difficulties to track after which update is became broken. As Filefield Paths didn't update for quite some time - then it leaves us with the updates of Filefield/Imagefield (maybe it requires some code changes to Filefield Paths module).

Any help would be appreciated.

Thanks
AndyB

While searching for a root cause of the issue I described above - looks like it might be unrelated to the watchdog error message, sorry for that.

I found another issue with the images disappearing #745768: Certain Imagefield Crop Files deleted after node save. Disabled the file name sanitization logic in the Filefield Paths for now.

I will raise another issue for my problem if needed - please consider it a separate one, not related to the initial one about the watchdog message.

AndyB

StatusFileSize
new580 bytes

wanted to bump this to the maintainers, to see if this patch is going to make the next release of filefield v3.x

in the code, an empty array is handled, but a null is not. this patch helps turn a null into an empty array, so the function can continue execution

thanks!

StatusFileSize
new598 bytes

I had the same error too, only that in my case $item was NULL ($file was a proper array), which was coming from $element not having any #default_value set.

And it happened only when no file was uploaded to a field (as actually I had 2 ImageFields and 1 FileField in the form - if all 3 of them were empty, I was getting 3 errors like this), after uploading at least one file error disappeared.

Attached patch did help in my case.

Title:Argument #2 is not an array in /sites/all/modules/filefield/filefield_widget.inc on line 254Argument #2 is not an array in /sites/all/modules/filefield/filefield_widget.inc on line 255
Version:6.x-3.7» 6.x-3.9
Status:Needs review» Needs work

patch in #3 made one of the errors (warnings) in #972044: Fully support multi-valued CCK fields go away. (editablefields)

Needs better comment 1) end with a period and 2) describe what the new code is doing, not just what was wrong before.

Status:Needs work» Needs review
StatusFileSize
new795 bytes

let me know if this is sufficient

This error also occurs when the files database table is missing an entry (accidental erasure etc ) refered to elsewhere.

Status:Needs review» Fixed
StatusFileSize
new413 bytes

I've committed this simple patch which accomplishes the exact same thing but just reuses the existing conditional instead of adding a new one.

Suggested approach from above:

    if (!$file) {
      $file = array();
    }
     // If the file entry doesn't exist, don't save anything.
     if (empty($file)) {
       $item = array();
     }

New approach:

     // If the file entry doesn't exist, don't save anything.
     if (empty($file)) {
       $item = array();
       $file = array();
     }

Thanks for your patience on this guys. Now that I've gone through the queue and cleaned up all the issues that have been solved I'll put out a new release shortly.

The 3.10 version of FileField is now available for your downloading pleasure. Please do not reopen this issue. File a new issue against 3.10 for further problems.

Status:Fixed» Closed (fixed)

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

Version:6.x-3.9» 6.x-3.10

I had 6.x-3.9 installed: i was getting the Argument #2 is not an array in /sites/all/modules/filefield/filefield_widget.inc on line 255 directory.

I then upgraded to 6.x-3.10. I am now consistently getting the following error:

Argument #1 is not an array in /sites/all/modules/filefield/filefield_widget.inc on line 255.

I have verified that the files do end up getting uploaded into the following directory:

.../sites/default/files/

I have spent almost half a day on this: NO AVAIL: my site is down: Please help!!!

In addition to the above post: If i try to upload file from Drupal back-end, it gives me following error message:

Fatal error: Only variables can be passed by reference in drupal/includes/form.inc on line 1345

Status:Closed (fixed)» Active

I'm seeing this with filefield 3.10. It gives the following 2 errors:

# warning: array_merge() [function.array-merge]: Argument #2 is not an array in sites/all/modules/contrib/filefield/filefield.module on line 319.
# warning: array_merge() [function.array-merge]: Argument #1 is not an array in sites/all/modules/contrib/filefield/filefield_widget.inc on line 255.

In filefield_widget_value, $edit is set to false and $element['#default_value'] is null. This goes down a different branch and doesn't activate the original fix. The site has a few custom modules that I'm still not familiar with so I'm not sure if filefield causes this but it can handle it easily by using

  if (isset($items[$delta]) && !empty($items[$delta])) {

instead of

  if (isset($items[$delta])) {

in filefield_widget (filefield.module)

The fix in #13 seems to work fine!

I've applied all the suggested patches, once at time. I still get the warning. Any idea?

Status:Active» Closed (fixed)