Fresh installation of Storm & Drupal 6. I tried to create a knowledgebase and I got the error:

warning: Invalid argument supplied for foreach() in /var/www/project/includes/form.inc on line 1415.

Thanks

Comments

stodge’s picture

Sorry, this was using Chrome 1.0.154.43.

RockyRoad’s picture

Project: Storm » Form Builder
Version: 6.x-1.20 »
Component: Code » Form Builder Core

I got the same error with Storm, but also with backup_migrate/Pgsql.

This warning shows up when #options value, in a form definition, is empty or invalid.

A better error message would possibly help module developers to fix the errors.
The foreach instruction expects an array or an object to iterate.
I would suggest this patch, in form,inc:

@@ -1406,6 +1406,10 @@
 function form_select_options($element, $choices = NULL) {
   if (!isset($choices)) {
     $choices = $element['#options'];
+    if (!(is_array($choices) || is_object($choices))) {
+      trigger_error("Invalid option list", E_USER_ERROR); 
+      return NULL;
+    }
   }
matt v.’s picture

Project: Form Builder » Storm
Version: » 6.x-1.20
Component: Form Builder Core » Code

The issue appears to be related to the value being loaded in line #197-198 of the stormknowledgebase.module. It wasn't loading the attributes correctly. I figured out a fix, but when I went to create a patch file, I realized that it's already been fixed in the latest DRUPAL-6--1 branch.

I verified the fix by downloading the latest version of the file from CVS. The error then went away and the topics were loaded correctly. Since the fix hasn't made it into an official release yet, I'll leave this issue as active, for now.

Magnity’s picture

Version: 6.x-1.20 » 6.x-1.21

Marked #391956: warning: Invalid argument supplied for foreach() in form.inc on line 1420. as a duplicate of this issue.

A new stable version has been released. Please test for this bug in this version. Thanks.

Magnity’s picture

Priority: Normal » Critical
Status: Active » Postponed (maintainer needs more info)

Changing priority as per #435504: TODO BEFORE STORM 1.22.

I'll close this one out soon though unless someone reports the error is still present.

Magnity’s picture

Status: Postponed (maintainer needs more info) » Fixed

Assuming fixed - please reopen if this bug is still an issue.

Status: Fixed » Closed (fixed)

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