Problem/Motivation

After upgrading the several notice appear when editing any node in the system.

Notice: Undefined index: required in field_default_form() (line 61 of /../drupal/modules/field/field.form.inc).

Workaround for D7 sites

As this is now committed to core for upgrading users suffering this on their Drupal 7 install can follow the manual fix:
- Visit each content type
- Check the required for each taxonomy term fields
- Save it.
- Optional revisit and uncheck the required for a selection of taxonomy term fields.

Original report by steinmb

Testing updating a small 6.19 installation and keep getting this warning when edition any node in the system.

* Notice: Undefined index: required in field_default_form() (line 61 of /Users/steinmb/htdocs/sites/smbjorklund.com/drupal/modules/field/field.form.inc).
* Notice: Undefined index: required in field_default_form() (line 61 of /Users/steinmb/htdocs/sites/smbjorklund.com/drupal/modules/field/field.form.inc).
* Notice: Undefined index: required in field_default_form() (line 61 of /Users/steinmb/htdocs/sites/smbjorklund.com/drupal/modules/field/field.form.inc).
* Notice: Undefined index: required in field_default_form() (line 61 of /Users/steinmb/htdocs/sites/smbjorklund.com/drupal/modules/field/field.form.inc).
* Notice: Undefined index: description in field_multiple_value_form() (line 155 of /Users/steinmb/htdocs/sites/smbjorklund.com/drupal/modules/field/field.form.inc).
* Notice: Undefined index: required in field_multiple_value_form() (line 173 of /Users/steinmb/htdocs/sites/smbjorklund.com/drupal/modules/field/field.form.inc).
* Notice: Undefined index: required in field_multiple_value_form() (line 202 of /Users/steinmb/htdocs/sites/smbjorklund.com/drupal/modules/field/field.form.inc).

The installer did not throw any error/warnings during the upgrade. As far as I have been able to find in the code is http://api.drupal.org/api/function/field_ui_default_value_widget/7 the only one using function field_default_form(), but after an upgrade is Field UI (field_ui.module) not enabled.

Comments

jpoesen’s picture

Got hit with that problem too.
Described in detail and solved here: http://drupal.org/node/931512

yched’s picture

Status: Active » Closed (duplicate)

Dupe of the issue pointed by jpoesen

clemens.tolboom’s picture

Status: Closed (duplicate) » Needs work

I reopen this as it is not a duplicate of #931512: Node body 'description' and 'required' are missed on nodes upgraded from D6 to D7

I get error even after applying the patch [#931512#56]

Notice: Undefined index: required in field_default_form() (line 75 of /Users/clemens/Sites/d7.build2be.dev/drupal/modules/field/field.form.inc).

It differences in function names field_default_form() versus field_multiple_value_form()

clemens.tolboom’s picture

My content type blog has a image field.

After migrating the image field with cck content_migrate the error is still there.

Visiting admin/structure/types then save the blog type does not help.

Visiting admin/structure/types/manage/blog/fields/field_images then saving shows 'allowed extensions' field empty but that still doesn't remove it.

I need to debug this tomorrow.

Kolibri’s picture

Version: 7.x-dev » 7.4
Category: bug » support

Hello, my content type "member" has an image field.
I migrated the site, and after this I'm now unable to delete or upload images over the edit-form of the content type.
I get the same Notice as clemens.tolboom.
"Notice: Undefined index: required in field_default_form() (line 75 of /www/htdocs/w00d7c70/intern/modules/field/field.form.inc)."
Has anyone an idea what the problem is?

clemens.tolboom’s picture

Version: 7.4 » 7.x-dev
Assigned: Unassigned » clemens.tolboom
Category: support » bug

@Kolibri: You changed the version and category.

- Please don't change a Bug (which this is about) into a support request.

- The bug is confirmed in drupal 7.x head code so it most probably also in 7.4

As I said I'm on it.

clemens.tolboom’s picture

Issue tags: +bug workaround, +6x upgrade to 7x

I found the problem which lies with taxonomy free form field I use. It is not required for my blog.

The required instance key is missing for taxonomy field during the upgrade.

Workaround: Checking the required, then saving, then unchecking the required fixed it.

I'll check the fix from #931512: Node body 'description' and 'required' are missed on nodes upgraded from D6 to D7 as it is a similar bug and make a new patch out of it

clemens.tolboom’s picture

Status: Needs work » Needs review
StatusFileSize
new1.46 KB

Patch contains similar test as #931512: Node body 'description' and 'required' are missed on nodes upgraded from D6 to D7.

The taxonomy terms do have the required field in drupal-6.filled.database.php defined. And are mixed yes/no required.

My test does only tests for the existence of the required key.

isset($instance['required']

Can we do better?

yched’s picture

Fix looks fine, but $vocabulary->required ? TRUE : FALSE, could be shortened to just $vocabulary->required ?

clemens.tolboom’s picture

Applied yched improvement.

Added minimal documentation to test lines.

yched’s picture

Status: Needs review » Reviewed & tested by the community

Oops, minor code style issue :

+++ b/modules/simpletest/tests/upgrade/upgrade.taxonomy.test
@@ -68,6 +68,12 @@ class UpgradePathTaxonomyTestCase extends UpgradePathTestCase {
+    // Ensure instance variables getting through

Missing trailing point.
Otherwise, looking good.

Powered by Dreditor.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Fixed that, then committed and pushed to 7.x. Thanks!

Status: Fixed » Closed (fixed)

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

snsace’s picture

I just upgraded 6 to 7.12 and get this same error as in #3.
For me the error is happening only when editing nodes of content type (Poll).

giorgio79’s picture

Changing to correct tag

snsace’s picture

Status: Closed (fixed) » Needs work
snsace’s picture

Sry, duplicate. Moved my inquiry here:
http://drupal.org/node/931512#comment-5707898

clemens.tolboom’s picture

Status: Needs work » Closed (fixed)
clemens.tolboom’s picture

Issue summary: View changes

Added template and added a workaround for D7 users upgraded before the patch.