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

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

Active

Version

9.5

Component
Media 

Last updated about 4 hours ago

Created by

🇺🇦Ukraine v.dovhaliuk

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024