TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in implode() (line 29 of /app/web/core/lib/Drupal/Core/Form/FormElementHelper.php)

Created on 11 April 2023, over 1 year ago
Updated 8 July 2024, 2 months ago

Problem/Motivation

When creating media, it is currently not possible to save the form due to an error. The error message reads as follows: TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in implode() (line 29 of /app/web/core/lib/Drupal/Core/Form/FormElementHelper.php).

Steps to reproduce

1. Add the entity_reference field to Media, and use the media library widget.
2. Set the alt text mandatory.
3. Open the Node form
4. Click "Add media"
5. Choose an image and try to save the media. Nothing happens and there is an error in the Watchdog.

6. If the "Alt text" has been added -- no errors, the form works correctly and media have been created.

Proposed resolution

Provide a patch to avoid errors in the validation process.

The correct work is when you try to save media without filling the mandatory field for Alternative text -- you get an error:

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Media 

Last updated less than a minute ago

Created by

🇺🇦Ukraine v.dovhaliuk

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

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

Production build 0.71.5 2024