warning: Invalid argument supplied for foreach() in /home/kystene/public_html/sites/all/modules/webform/webform.module on line 451.

At first, this was an upgrade of the module that I had disabled some time ago. I got that error, so I disabled and uninstalled before reinstalling. I am still getting the error when saving a webform.

Comments

kew0282’s picture

I get the same problem--I am trying to install it for the first time

aitchm’s picture

Me too. I installed yesterday and when testing today I get the message after attempting to add the first component to a form.

wescoughlin’s picture

Same here. Anyone know anything about it? Seems like things still work ok.

chicagoshark’s picture

I am facing this issue also. Downloaded and installed WebForms today. I really liked the functionality, but the warning message showing here will be a show stopper...

quicksketch’s picture

Has anyone tested out the 1.x latest version to see if the problem still exists in the latest copy? I think this may have already been fixed.

yopyop’s picture

I also have this issue, using drupal 5.5 and the latest webform 1.8.

quicksketch’s picture

@yopyop, could you try out the 1.x development version and report if the problem still exists there?

Nikkol’s picture

In my particular case, I saved the webform without having any fields added to it. Once I added a field, the error went away. Those who have posted here should check this. While the error should be fixed, it really was nothing more than a minor annoyance for me.

rfranquet’s picture

I cheked the 5.x-1.x-dev 2008-Feb-01 130.48 KB release and this issue has been fixed in my website.

dualdiesel’s picture

Got this error as well. try to move forward...
Set up a web form and upon trying to submit a text field I received the following error
even though my index.php file is set to 777

: (

You don't have permission to access /index.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.37 Server at iamdrugs.com Port 80

quicksketch’s picture

Status: Active » Fixed

dualdiesel, hmm sounds like a separate problem than the foreach() error, which I'll consider fixed with rfranquet's confirmation.

lego1974’s picture

The reason this warning arises is because in many cases (the first time you create a webform), $node->webformcomponents is NULL. The value of the variable needs to be checked before performing operations on it. This isn't a gigantic issue, but it's generally not a good idea, because it has the potential to lead to unexpected behavior.

simply modifying line 451from this:

   if ($op !== t('Done') ) {

to this:

   if ($op !== t('Done') && ($node->webformcomponents != NULL)) {

Should do the trick.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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