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

That is what I get anytime I try and mess with the author information block on Drupal 6.

Hopefully someone can confirm this as well.

Comments

Folkert’s picture

Component: block.module » profile.module
Status: Active » Needs review
StatusFileSize
new781 bytes

Actually that has little to do with block.module and more with profile.module.

In the profile_block function the variable '$form['profile_block_author_fields'] has it's default_value set to NULL as in

$form['profile_block_author_fields'] = array('#type' => 'checkboxes',
      '#title' => t('Profile fields to display'),
      '#default_value' => variable_get('profile_block_author_fields', NULL),
     //......snip

Added a patch which clears the error by setting the default value to array() instead of NULL

Please review, first drupal patch

matthew petty’s picture

Version: 6.0 » 6.1

This is still an issue for 6.1...

pobster’s picture

Indeed it is... Still at least now I know how to fix it!

linguaetc’s picture

I also receive the error in 6.2. I changed the NULL to array() in profile.module but the error remains. I logged out and back in with no success. What should I do for the change to take affect?

JMowery’s picture

Version: 6.1 » 6.2

Needs to be fixed or integrated.

webchick’s picture

Version: 6.2 » 7.x-dev
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1009 bytes

You can reproduce this by going to admin/build/block/configure/profile/author-information with profile module enabled. This wasn't clear to me from the original description.

Applies to 7.x, too, with some fuzz, and solves the issue for me. I'm not sure why this didn't work for linguaetc. Here's a clean re-roll for 7.x.

While I don't think this qualifies as a "critical" bug, it is very nasty for Drupal to be displaying errors like this.

webchick’s picture

Title: Author Information Module Broke|warning: Invalid argument supplied for foreach() in /var/www/html/includes/form.inc on line 1181 » Author Information Block broken: Invalid argument supplied for foreach() in form.inc

Fixing title somewhat.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD and DRUPAL-6. Thanks webchick and Folkert.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

codex73’s picture

Where do i add this patch ?

Terysa’s picture

Title: Author Information Block broken: Invalid argument supplied for foreach() in form.inc » TinyMCE install: warning: Invalid argument supplied for foreach() in includes/form.inc on line 1181
Version: 7.x-dev » 6.2
Component: profile.module » other
Assigned: Unassigned » Terysa
Priority: Normal » Critical
Status: Closed (fixed) » Active

When I installed tinyMCE and try to add a profile - this error
warning: Invalid argument supplied for foreach() in includes/form.inc on line 1181.

asimmonds’s picture

Title: TinyMCE install: warning: Invalid argument supplied for foreach() in includes/form.inc on line 1181 » Author Information Block broken: Invalid argument supplied for foreach() in form.inc
Version: 6.2 » 7.x-dev
Component: other » profile.module
Assigned: Terysa » Unassigned
Priority: Critical » Normal
Status: Active » Closed (fixed)

@Terysa: please do not hijack issues, you possibly want http://drupal.org/node/245531