Problem/Motivation
After migration from PHP 7.4 to PHP 8.0, and trying to write a Comment, we get this error:
TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in implode() (line 1104 of /DRUPAL_FOLDER/modules/field/field.module).
Steps to reproduce
Just try to create a comment.
Proposed resolution
Change from this:
$variables['classes'] = implode('', $variables['classes_array']);
to this:
if(is_array($variables['classes_array']))
{
$variables['classes'] = implode('', $variables['classes_array']);
}
else if (is_string($variables['classes_array']))
{
$variables['classes'] = implode('', (array)$variables['classes_array']);
}
Maybe there is a better way to do this.