I was trying to run Webform 6.x-3.2, but kept having the problem that the form would not appear after being saved (http://drupal.org/node/904918). I disabled and uninstalled the module in order to clear any tables out of the db, and then installed 6.x-2.10 (the issue says 2.9 because 2.10 was not on the dropdown list). Now, when I go to the tab to add form components, I get the error:
* warning: Invalid argument supplied for foreach() in /home2/usrname/public_html/_sitename/sites/all/modules/webform/webform_components.inc on line 31.
I tried just pushing through and adding something to the form anyway, and got this error after adding a form element:
* warning: Invalid argument supplied for foreach() in /home2/usrname/public_html/_sitename/sites/all/modules/webform/webform_components.inc on line 419.
* warning: Invalid argument supplied for foreach() in /home2/usrname/public_html/_sitename/sites/all/modules/webform/webform_components.inc on line 31.
I have been using Webform for about 2 years on multiple site with no problems. These issues are the first I've had.
Comments
Comment #1
quicksketchHmm, my guess is there is a problem with your downgrade. Most likely there are still some residual problems after uninstalling the 3.x version and using 2.x again. This problem is not reproducible (as far as I can tell) from a clean install of Webform.
Comment #2
amanire commentedI'm experiencing this error too, so it's reproducible. The errors are associated with the line
foreach ($node->webform['components'] as $cid => $component) {It's throwing the error because there is no webform array associated with the node.
Comment #3
quicksketchIf it's reproducible, could you provide steps to reproduce it from a clean Drupal install? I think there's something wrong with the installation that is causing this.
Comment #4
amanire commentedOK, I replicated this on a clean install w/Drupal 6.19 using Drush 3.3.
Possibly related to the fact that 3.2's uninstall leaves the form components in place?
Comment #5
amanire commentedThe same error message also appears after submitting a new webform node and arriving at the form components section.
Comment #6
quicksketchHm, this is because the webform node in question is now incomplete. Drupal and Webform do not delete content when uninstalling modules, though that content is now damaged. You could think of this as being the same as enabling the "blog" module, creating blog entries, then uninstalling the blog module. The content still exists but it no longer works correctly. If downgrading, you should delete the Webform nodes that were created with 3.x.
Comment #7
amanire commentedYou can actually scratch step 2 from #4 above because it also occurs if no content is created in 3.2 and new webforms are added in the downgraded version.
I've tracked this down to the node_type.module field, which says "node" instead of "webform".
Comment #8
nitrospectide commentedShould I just disable the 2.10 module, drop the following tables, and re-enable to start from scratch?
webform
webform_component
webform_roles
webform_submissions
webform_submitted_data
Comment #9
amanire commentedSo, this is definitely caused by the default webform type in the 3.2 webform install. It's not clear to me whether node_type_delete() should be executed during an uninstall. I would've thought so, but based on other threads that I've read, it seems like this would break the integrity of any existing webform nodes that had not been deleted.
Comment #10
amanire commentednitrospectide,
The quick fix in your situation is to manually change the value of the module field in the node_type table from "node" to "webform".
Comment #11
quicksketchYeah, all told I'm not sure Webform should change this behavior. If uninstalling actually deleted the Webform content type, it would result in the content no longer even being editable at all since no type is registered with the content. I think amanire's suggestion is the best one, manually change the module back to "webform" in the node_type table.
Comment #12
quicksketch