Notice: Undefined index: #parents in a Form/FormElementHelper.php

Created on 15 June 2020, about 5 years ago
Updated 2 March 2023, over 2 years ago

Seeing this Notice when saving a node edit form:

Notice: Undefined index: #parents in /app/core/lib/Drupal/Core/Form/FormElementHelper.php.
πŸ› Bug report
Status

Needs review

Version

9.5

Component
FormΒ  β†’

Last updated about 3 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States brooke_heaton

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The problem this patch is addressing was throwing only notices on PHP 7.4 but is throwing errors on PHP 8+, so the patch is valid I think. Steps to reproduce this using the focal_point module:

    On Vanilla Drupal 9.5+

    • Enable the modules media, media_library and focal_point
    • Add an image style with a focal_point image effect
    • Configure the media_library form display of image media to use the Image (Focal point) field widget
    • Add a media field to the article content type
    • Configure the form display of the article content type to use the media_library widget
    • Add an article and add a media to the article by uploading a new image
    • After uploading the image, do not enter an alt text and click save

    There will be an ajax error originating from the location in code the patch here changes.

  • Status changed to Needs work over 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    If valid it will need a test case to show the issue.

    Though not sure that’s a fix that would get committed. This may be covering a symptom of a bigger issue. Like why is that value not set when it gets to this point?

    But either way tests will 100% be needed

  • πŸ‡­πŸ‡ΊHungary szato

    Maybe related to Focal point image widget causes validation errors not to be shown πŸ› Focal point image widget causes validation errors not to be shown Needs work ?

  • πŸ‡¨πŸ‡¦Canada hargurpreet Kitchener

    Updated patch #3 to fix a notice in core/lib/Drupal/Core/Form/FormState.php on line 1174

  • πŸ‡ΊπŸ‡ΈUnited States pixlkat

    I also was seeing this error, but with different form elements. We have a taxonomy entity reference field with unlimited cardinality, and we are using inline entity form to add an existing term. We are also using Inline Form Errors to display error messages inline.

    When submitting the IEF form with an error condition, it appears that the `actions` element was the form element causing the error. This issue was not present when using IEF to add a new entity.

    Applying the patch in #14 fixed the error in our case.

Production build 0.71.5 2024