Undefined offset error in FileWidget and ImageWidget

Created on 16 July 2018, over 6 years ago
Updated 10 July 2023, over 1 year ago

This is re-reporting issue 2843977 which was closed as a duplicate (mistakenly, I suspect) of issue 2908866 (which were different errors).

When saving a condition the following warnings/notices are reported:

Notice: Undefined offset: 0 in Drupal\file\Plugin\Field\FieldWidget\FileWidget->formMultipleElements() (line 196 of core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php)
Notice: Undefined offset: 0 in Drupal\image\Plugin\Field\FieldWidget\ImageWidget->formMultipleElements() (line 123 of core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php)

Note that these errors are specifically File and Image widget. I have an image field on the node content type, but it's not part of any of the conditions that I'm setting. The conditions are all hide/show of text field selectors and numeric fields based on a 'type' selector.

πŸ› Bug report
Status

Active

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom andy_read

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.

  • πŸ‡­πŸ‡·Croatia devad

    D10.1.1, PHP8.1

    This bug is still here.

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

    same for d10.3.2

    +1 for resolution made to conditional fields. Patch from #2 πŸ› Notice: Undefined offset: 0 in /Field/FieldWidget/FileWidget.php on line 195 Closed: works as designed resolves the issues.

  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

    Link issues in summary.

  • πŸ‡«πŸ‡·France webmestre

    On D10.4.2 / php 8.3.16 with 4.0.0-alpha6 module version, get such error messages:

    • Warning: Undefined array key 0 in Drupal\file\Plugin\Field\FieldWidget\FileWidget->formMultipleElements() (line 199 of core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php).
    • Warning: Trying to access array offset on null in Drupal\file\Plugin\Field\FieldWidget\FileWidget->formMultipleElements() (line 199 of core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php).
    • Warning: Undefined array key 0 in Drupal\image\Plugin\Field\FieldWidget\ImageWidget->formMultipleElements() (line 121 of core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php).
    • Warning: Trying to access array offset on null in Drupal\image\Plugin\Field\FieldWidget\ImageWidget->formMultipleElements() (line 121 of core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php).

    When the dependee is a multivalue taxonomy field.

    On D11, that works fine in the same situation.

  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

    The issue referred-to in #12 and #16 is closed (works as designed). The closing comment says that the problem should be fixed in this issue.

Production build 0.71.5 2024