Solution add is_array check before foreach loop.

CommentFileSizeAuthor
#7 image_fupload_imagefield_module.patch1.08 KBjcmc

Comments

tevih’s picture

can you please elaborate on your fix? I'm new at this and I'm having the same issue.

grandcat’s picture

Can't reproduce this error message. Perhaps you added some fields and didn't resave ImageFields settings page.

sinsinapsi’s picture

Hi,
get the same error,
really not expert, I'm sorry
but I cannot understand the solution,

"Solution add is_array check before foreach loop."

I get this error below, just after a fresh installation.

Fatal error: Call to undefined function image_node_type_load() in .../modules/image_fupload/image_fupload_imagefield/image_fupload_imagefield.module on line 60

Can someone explain me how work the solution proposed above?

mattyoung’s picture

I encountered this same error:

warning: Invalid argument supplied for foreach() in /var/www/html/drupal/sites/all/modules/image_fupload/image_fupload_imagefield/image_fupload_imagefield.module on line 506.

I had one image field using the FUpload widget, then I went and edit content type and change the name and id. That's it. Seems under some condition like this, form_fields_destroy() is called with $fields_to_remove == NULL?

whatdoesitwant’s picture

Thnx Matt. I can confirm that this workaround works with 6.x-3.0-dev (current release is september 2009) as well. I had changed the name of Story to Article with no result. But changing the machine readable type story to article fixed the error, (which is thrown at line 553 in dev).

zoo’s picture

Hello, everybody.

I have just installed image fupload module (6.x-3.0-rc2 along with imagefield/filefield 6.x-3.2) and changed the widget type of an existing CCK field file type to "Image FUpload".

Now when I'm going to create a new page, based on the above content type, have this error at the top of the page:

warning: Invalid argument supplied for foreach() in ***fupload_imagefield.module on line 506.

I didn't quite understand how the solution works, I would appreciate if someone could explain one more time.

Thank You very much

bye

zoo

jcmc’s picture

StatusFileSize
new1.08 KB

Hello zoo and co,

here a patch to avoid this simple php error. It is a peculiarity of the function "foreach" in php in case the array is empty.

Regards
Juan Carlos

zoo’s picture

Thank You very much for your help!

zoo

gingic’s picture

Hello,

I got the same error...
How can I install the patch?

Thanks

grandcat’s picture

Status: Active » Patch (to be ported)
grandcat’s picture

Status: Patch (to be ported) » Fixed

Committed to HEAD, thanks to jcmc and all others.

Status: Fixed » Closed (fixed)

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

fxarte’s picture

Hi
In my case it was because there was no image cache preset selected in the field definition. Once I created and selected the preset, the error was gone

ggevalt’s picture

ANOTHER EASY SOLUTION....

This is occurring because of conflicting default settings in your image field (if you created one before you used the FUpload module...) To fix this, go into your Content Type>>Manage Fields>>Image field (or whatever you called it) and click CONFIGURE.... choose "Multiple Images Per Node", scroll down and choose "UNLIMITED" in "Maximum number of values users can enter for this field."

should work. no patches or scary coding needed.
geoff

stephesk8s’s picture

#14 makes sense. And worked for me. Thanks.