There is some kind of race condition when installing a module that adds fields, where core tries to assign weights to fields that have not yet been defined. For example, when enabling the simplenews module, I got the following notices:
- Notice: Undefined index: email_plain in field_info_max_weight() (line 797 of /home/bobvin/Downloads/drupal/modules/field/field.info.inc).
- Notice: Undefined index: email_html in field_info_max_weight() (line 797 of /home/bobvin/Downloads/drupal/modules/field/field.info.inc).
- Notice: Undefined index: email_textalt in field_info_max_weight() (line 797 of /home/bobvin/Downloads/drupal/modules/field/field.info.inc).
Suggested one-line fix/workaround:
--- modules/field/field.info.inc
+++ modules/field/field.info.inc
@@ -793,7 +793,7 @@ function field_info_max_weight($entity_type, $bundle, $context) {
if ($context == 'form') {
$weights[] = $instance['widget']['weight'];
}
- else {
+ elsif (isset($instance['display'][$context]['weight'])) {
$weights[] = $instance['display'][$context]['weight'];
}
}
Comments
Comment #1
pillarsdotnet commentedFixed typo
Comment #2
pfrenssenI can confirm this issue. I have reviewed and tested the patch. It solves the problem.
Comment #3
dries commentedAny reason why $instance['display'][$context]['weight'] is not set? Does it have to be set? Could be a bug elsewhere.
Comment #4
webchickLet's add a test for this, and maybe that will point the way.
Comment #5
scotwith1tsub
Comment #6
Tor Arne Thune commentedThis bugged popped up when I installed and enabled Ubercart 7.x-3.0-beta1 Cart, Order, Product and Store in one go.
Notice: Undefined index: full in field_info_max_weight() (line 797 of /var/www/devia.org/modules/field/field.info.inc).Comment #7
yched commentedThe fix is correct. $instance['display'][$context]['weight'] might not be set if the view mode doesn't use custom display settings.
I'm not really sure this deserves a test (nor that it's easily testable), so tentatively setting back to RTBC
Comment #8
pillarsdotnet commentedClosed #981534: Undefined index error upon installation (field.info.inc) as a duplicate of this issue.
Comment #9
dries commentedCommitted to CVS HEAD (without test). It still had the 'Needs tests' tag.
Comment #11
scottlozier commentedPatch fixed issue.
Comment #12
Vilas Boas commentedThe bug is still active
Notice: Undefined index: email_html em field_info_max_weight() (linha 797 de /XXX/modules/field/field.info.inc).
Comment #13
JohanPirlouit commentedHi everyone,
I'm afraid that this bug may still be active: see Media Gallery 7.x install issue -> Undefined index: media_gallery_detail in field_info_max_weight(). If I'm wrong, I'll be sorry for this report ;-)
My Drupal version is 7.0 fresh install.
Some modules I installed and activated for my needs (and they work fine) before trying to install Media Gallery:
- IMCE 7.x-1.3
- CKEditor 7.x-1.1
- Webform 7.x-3.9
Modules I also installed and activated that are required for Media Gallery:
- Media 7.x-1.0-beta4
- Multiple forms 7.x-1.0-beta2
- Styles 7.x-2.0-alpha5
- ColorBox jQuery plugin 1.3.16
When I try to activate Media Gallery module (last release at this post time: 7.x-1.0-beta4) I receive those messages:
Regards,
Johan
Comment #14
yched commented@JohanPirlouit : "My Drupal version is 7.0 fresh install."
The fix was committed after the 7.0 release. This means you'll need 7.x-dev (or 7.1 when it gets out).
Comment #15
JohanPirlouit commented@yched > You're right! It works.
But, as it is a dev version (7.x-dev), I've got other issues ^^:
- When I edit my published gallery:
- After I edit settings of the little Media Gallery block:
So I think field.info.inc is no more concerned ;-))... And I will investigate for other bugs that could have been reported about my new issues.
Regards,
Johan
Comment #16
spasebar commentedHi everyone. I am getting this same error message, but I am not sure how to apply the patch. Where do I enter the code? I copy and pasted all of it in the field.info.inc file but get syntax errors. I thought it was suppose to be a one line fix? Sorry, as you can see I'm still an big noob. (Umm, is it even still cool to say noob anymore?) LOL
Thanks for the help guys if you would be so kind.
Comment #17
pfrenssenThe basic steps to apply a patch to Drupal core are:
The patch can be applied using a variety of GUI tools and IDEs, but the easiest and fastest way is to do it is using the 'patch' command in terminal:
You can find more information about patching on Wikipedia or in the section about patching in the Drupal documentation.
Comment #18
spasebar commentedUmm, I'm still confused. How do I do this on a command line??? Where is terminal? Sorry. I really need step by step like total newbie instructions.
Oh, when I click on the link, it opens the file, should I just right click on it and save it, and then upload it to the root of my Drupal folder? If so, then I don't know how to apply it.
Comment #19
pillarsdotnet commented@spasebar -- Dries already committed this patch. So you can either download the snapshot version of Drupal-7 from here, or just wait a couple of weeks until 7.1 comes out.
Comment #20
spasebar commentedHi Pillar... oh okay, I think I might just wait. I'm kind of just experimenting with Drupal 7 and Ubercart. So I guess as long as I can kind of add products and theme, it should be okay, because we won't be going live just yet. So 7.1 should be coming out in the next couple of weeks?
Those errors don't seem to be affecting anything anyways right now as far as what I'm doing.
Comment #21
mercclear commentedDrupal 7.2
I just installed commerce shipment module with the same message
Notice: Undefined index: ................. in field_info_max_weight() (line 797 of ........ /modules/field/field.info.inc)
:-((
Comment #22
pillarsdotnet commentedComment #23
Tor Arne Thune commentedComment #24
adam_b commentedI'm getting this error with D7.8 after uninstalling the Media Gallery module: lots of instances such as
Notice: Undefined index: media_gallery_lightbox in field_extra_fields_get_display() (line 727 of /mnt/www/html/[site]/docroot/modules/field/field.module).It went away by itself after a few minutes.
Has anything happened with this recently?
Comment #25
pillarsdotnet commentedPeople who are still experiencing this problem need to document a way to make it happen, starting with a fresh install of Drupal 8.x-dev or Drupal 7.x-dev.
It is very hard to fix a problem that is neither documented nor easily duplicated.
Comment #26
summit commentedHi,
Next to #1 I also have this bug on $extra fields (line 811). I had to change:
To
To remove this bug.
Latest Drupal 7 with Latest Commerce.
I am not able to build patches, but hopefully some of you guys can.
Thanks in advance
Greetings, Martijn
Comment #40
pameeela commentedThanks for reporting this issue. We rely on issue reports like this one to resolve bugs and improve Drupal core.
As part of the Bug Smash Initiative, we are triaging issues that are marked "Postponed (maintainer needs more info)".
Since there were no specific steps to reproduce the issue provided since the issue was postponed, I'm marking the issue "Closed (cannot reproduce)". If anyone can provide complete steps to reproduce the issue (starting from "Install Drupal core"), document those steps in the issue summary and set the issue status back to "Active".
Thanks!
Comment #41
pameeela commented