After installation of the webform module I wanted create a little testform, but after saving the form I got the following warning:

"Invalid argument supplied for foreach() in .../sites/all/modules/webform/webform_components.inc on line 31"

If I want to add fields to this form i get the following warnings:

"Invalid argument supplied for foreach() in .../sites/all/modules/webform/webform_components.inc on line 244"
and
"Invalid argument supplied for foreach() in .../sites/all/modules/webform/webform_components.inc on line 31"

There ist the same behavior after deleting this version and installation of the new version "6.x-3.x-dev".

I apologize if this is already reported or addressed elsewhere. But I didn't find a solution yet.

Thanks

Comments

quicksketch’s picture

Category: bug » support

You cannot run the 3.x version and then downgrade to 2.x. You've probably permanently damaged your database. You'll need to delete all the webform tables from your database and all the entries from the variables table that begin with webform_.

iceman2202’s picture

Thanks for the hint. But I think, the problem was already there before the downgrade to 6.x-2.9.

After uninstalling webform, then deleting all webform-Tables and variables and new installation of webform 6.x-2.9 the problem exists furthermore.

Perhaps, you can give me another hint?

quicksketch’s picture

Hmm, the line in question here is:

foreach ($node->webform['components'] as $cid => $component) {

My guess is that this node is of type "webform", but since Webform was uninstalled all of its components are missing yet the node was not deleted (Webform does not delete nodes even if it's uninstalled). Try deleting all the previous nodes of type "webform" and creating a new one.

I know for sure that the error you're describing does not exist on a clean install, considering the thousands of other active installations running the 2.9 version.

iceman2202’s picture

I had some webform installations in test environments before without problems. One of these environments ist still alive und is running with webform without errors!

Now I made the following attempts after your replies:

  • deleted all webform nodes
  • uninstall of the webform module
  • deleted all variables "webform_" in table "variable"
  • deleted webform in table "system"
  • There isn't any change. The same errors as before!

    This drupal installation should soon become productive and webform is one of the important components. Is there a possibility to reach a "clean" webform environment without complete installation of drupal and the modules?

    bdhoundus’s picture

    I am having the same problem as iceman. I accidentally upgraded from 2.9 to 3.x-dev... and the web form used on the site was broken. I tried reverting back to 2.9 and got the same error messages as iceman. I deleted the webform node, deactivated the webform module, uninstalled the webform module, removed the webform_ entries in the variables table and verified that all of the webform_ tables were gone. Installed 2.9, activated it, ran update.php (now no errors when running update.php), made sure permissions were correct for the webform module.
    Created a new webform node (no problem). Went to add a form component and got the same following errors:
    "Invalid argument supplied for foreach() in .../sites/all/modules/webform/webform_components.inc on line 244"
    and
    "Invalid argument supplied for foreach() in .../sites/all/modules/webform/webform_components.inc on line 31"

    After attempting to enter components, if I look at the webform_component table, I see the added components in the table. They just won't appear when trying to edit the node (and don't show when viewing the node either). Where do the form components get married to the node in the database?

    bdhoundus’s picture

    Well, I repeated the uninstall of the webform module today. In addition to the steps mentioned before, I also went into phpMyadmin and did a search in all tables for "webform".
    It will be found in a bunch of tables. The only tables that I went in and deleted the "webform" entries from were the following:
    menu_links (3 records found)
    menu_router (4 records found)
    node_type (1 record found)

    After that, I also selected all the tables and did an "optimize" just to clean things up. Then, I reinstalled Webform 2.9 and everything was working fine.

    Rick Nashleanas’s picture

    Subscribing.

    iceman2202’s picture

    Status: Active » Closed (fixed)

    Thank you bdhoundus,

    I deleted all the the webform entries in the same tables (menu_links, menu_router, node_type ).

    Now it works fine.

    roball’s picture

    Status: Closed (fixed) » Fixed

    Same problem observed here - seems that the 3.x-dev uninstaller needs work. Fixed by manually deleting the tables as mentioned in #6.

    roball’s picture

    [OT] BTW, bdhoundus (#5), what was broken after you upgraded from 2.9 to 3.x-dev? I did not get something broken after the upgrade.

    mathieu_ch’s picture

    Had the same problem with a downgrade Webform from 3.x to 2.9.

    Here's my recipe, works for sure: I don't run in "cant display component" errors anymore.

    • Delete all Webform nodes
    • Disable AND uninstall the Webform module
    • Delete all webform tables that would still be around. (I didn't had to go through the system and variable tables)
    • Delete the Webform content type also.
    • Now you can start from scratch

    Status: Fixed » Closed (fixed)

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

    troynt’s picture

    Status: Active » Closed (fixed)

    Still seeing this issue after following advice of #11 & #6

    What is causing this?

    troynt’s picture

    Status: Closed (fixed) » Active

    ^forgot to reopen

    quicksketch’s picture

    Marat’s picture

    Delete the Webform content type also.

    This is the thing that I missed and made a lot of trouble! Thanks

    ggevalt’s picture

    I must say that after struggling with this for several hours today, it's nice to find this, but it's also too bad to see some really incomplete information about this module. We had not used this module in a while and really had not been aware that we'd updated the module like good doobies but as soon as we activated it it blew apart our whole site. Three hours later, we were able to get everything back to normal and now have nonworking Webforms and have to go through all these hoops to somehow fix all the references to webform and then try all over again.

    Please do not misunderstand. I so appreciate the work that is done with drupal by all you folks. but man it is hard to see this kind of damage from a module that clearly has flaws and should not have been put out there. I realize the module says that you can't revert back, but there was absolutely no hint as to the kinds of trouble that could occur by upgrading to the 6.3 version. And frankly, the prospect of now further repairing my "damaged" database is daunting. And incredibly frustrating.

    The problems with upgrading this module to 6.3 really should be outlined more clearly. I can tell you this, it turned my entire site into WSOD. And I've been picking up the pieces ever since.

    And I don't mean this to sound harsh. Really.