warning: Invalid argument supplied for foreach() in /var/www/vhosts/srajonathanblakeperry.org/public_html/modules/flashnode/flashnode.module on line 339.

This shows up on my site! I have reinstalled drupal, reimported certain parts of my database and so on to get it back up and running! What do I do here, didn't happen before I broke my site!

Comments

byingling’s picture

Priority: Normal » Critical
Stuart Greenfield’s picture

This error usually means that the system hasn't loaded data from the flash node table properly, so there are no parameters for it to cycle through.

Has the table been created properly?

If you go to admin/build/schema/describe what does it say? A working install should have:

vid int, unsigned NO
Primary key: node.vid for revision tracking of Flash nodes.

fid int, unsigned NO
file.fid associated with each Flash node revision.

nid int, unsigned NO
node.nid with which the Flash file is associated.

height int, unsigned NO
Display height, in pixels, of the Flash file.

width int, unsigned NO
Display width, in pixels, of the Flash file.

display int:tiny, unsigned NO
Display mode for the Flash file in this node: 0 = teaser and body, 1 = teaser only, 2 = body only.

substitution text:big NO
Substitution text to display if using a JavaScript replacement method.

flashvars text:big NO
Flashvars to pass to the Flash file.

base varchar(255) NO
Base parameter to pass to the Flash file.

Stuart Greenfield’s picture

This error also seems to occur if the flash upload fails (e.g. a large file), as the database doesn't get updated properly. One fix is to try and work out what node has the missing flash file, and re-upload the swf, or delete the node and create a new one. That might clear the error too.

huizus’s picture

I had the exact same problem as the report described a coupe of weeks ago. It is not related to flashnode installation though because everything worked at my local box but it failed to display the flash page at my remote test box (took the exact database dump from my local box). I think the issue could be related to some apache configuration at my remote test box which I am still trying to figure out.

carole’s picture

I'm getting the same error when I add a flash node. When I reload the node ("View" mode), the warning goes away.

warning: Invalid argument supplied for foreach() in C:\wamp\www\cry\drupal\sites\default\modules\flashnode\flashnode.module on line 354.
Remember you might have to set the movie size for flv or mp3 files as flash node cannot always automatically determine the player size!

Stuart, how do you invoke admin/build/schema/describe? That path doesn't load in my site.

Also, can I suppress the warning "Remember you might have to set the movie size for flv or mp3..."? I'm using this for user-entered content, and don't want to cause confusion. I've used the great permissions settings to disable the options, but can't disable the warning.

Stuart Greenfield’s picture

This foreach warning seems to be cropping up for some users and not others. It occurs because the data doesn't seem to be loaded from the database (or maybe it wasn't written?). I have never had this error on my test set ups, so I'm struggling to diagnose where it is coming from. I am trying though! From your path it sounds like you are running a Windows set up? MySQL or PostGres?

At the moment you can't suppress the warning, but maybe I should make that an option on the settings page, that should do it.

To get to the schema report you can go to Administer > Site building > Schema. From there you can navigate the tables and get descriptions etc.