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.
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
Comment | File | Size | Author |
---|---|---|---|
#8 | filefield_array_merge_missing_file.patch | 413 bytes | quicksketch |
#6 | filefield.missingfile_3.9.patch | 795 bytes | craig_ |
#4 | filefield_widget.notanarray.patch | 598 bytes | maciej.zgadzaj |
#3 | filefield.missingfile.patch | 580 bytes | craig_ |
filefield_handle_file_missing.patch | 580 bytes | craig_ |
Comments
Comment #1
duozerskI 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
Comment #2
duozerskWhile 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
Comment #3
craig_ CreditAttribution: craig_ commentedwanted 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!
Comment #4
maciej.zgadzaj CreditAttribution: maciej.zgadzaj commentedI 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.
Comment #5
YesCT CreditAttribution: YesCT commentedpatch 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.
Comment #6
craig_ CreditAttribution: craig_ commentedlet me know if this is sufficient
Comment #7
Von Gunther CreditAttribution: Von Gunther commentedThis error also occurs when the files database table is missing an entry (accidental erasure etc ) refered to elsewhere.
Comment #8
quicksketchI'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:
New approach:
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.
Comment #9
quicksketchThe 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.
Comment #11
tfmy2k CreditAttribution: tfmy2k commentedI 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!!!
Comment #12
tfmy2k CreditAttribution: tfmy2k commentedIn 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
Comment #13
rgarand CreditAttribution: rgarand commentedI'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
instead of
in filefield_widget (filefield.module)
Comment #14
NitebreedThe fix in #13 seems to work fine!
Comment #15
scriptaimago CreditAttribution: scriptaimago commentedI've applied all the suggested patches, once at time. I still get the warning. Any idea?
Comment #16
quicksketchThe suggested change in #13 was made in #1171760: warning: array_merge() [function.array-merge]: Argument #2 is not an array when using CCK 3.x.