Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When the $form[$field_name] isn't set for this field_attach_form() function, you receive an undefined index error. Needs to add in the sanity checking around that element in the function.
Comments
Comment #1
laughnanPatch for this issue.
Comment #2
laughnanComment #3
DamienMcKennaNeeds to be reviewed against the latest -dev release.
Comment #5
laughnanThanks for testing this @DamienMcKenna :)
Comment #6
BoobaaI ran into this issue while tried to add field_collection support to Comment Alter, and can confirm that: 1. the patch applies cleanly to field_collection-7.x-1.0-beta8, 2. it solves the problem properly. However, I haven't tested it with the latest field_collection-7.x-1.x-dev, and that's the only thing I'm not marking this issue as RTBC – although @DamienMcKenna's testbot run was a success two months ago, so I'm pretty sure it should be still okay.
Comment #7
laughnanThanks for the note @Boobaa!
Comment #8
jordan8037310 CreditAttribution: jordan8037310 commentedThanks for the patch, can also confirm this works on field_collection-7.x-1.0-beta8.
I downloaded the most recent field_collection-7.x-1.x-dev and also successfully applied this patch:
Hunk #1 succeeded at 1009 (offset -510 lines).
Comment #9
laughnanWoohoo! Thanks for the update @jordan8037310
Comment #10
jordan8037310 CreditAttribution: jordan8037310 at Facet Interactive commentedHere is the patch for -dev release... Doesn't look like the re-queued for testing worked on previous patch.
Comment #11
captainack CreditAttribution: captainack commentedThanks for the patch guys.
FYI on the current dev, the patch attached only partially solves the problem. One more edit is required for the next if block. Patch coming...
Comment #12
captainack CreditAttribution: captainack commentedComment #13
Alex Bukach CreditAttribution: Alex Bukach commentedWe can add a single check in the beginning of the loop.
Comment #14
Alex Bukach CreditAttribution: Alex Bukach commentedComment #15
renatogI applied the #14 really makes sense. We are verifying if the
$form[$field_name]
exists (isset) in the beginning of loop. If not we can skip to the next loopIt worked well +1 to this
Comment #17
renatogMoved to the dev branch
Thank you so much everyone for your contribution