Exception thrown when message uses PluralTranslatableMarkup

Created on 7 August 2023, over 1 year ago

Problem/Motivation

When the message to be displayed is an instance of Drupal\Core\StringTranslation\PluralTranslatableMarkup, the following exception is thrown: Error: Cannot use object of type Drupal\Core\StringTranslation\PluralTranslatableMarkup as array in Drupal\Core\Render\Renderer->doRender() (line 225 of /var/www/html/public_html/core/lib/Drupal/Core/Render/Renderer.php).

Steps to reproduce

I faced it by visiting a Input Format's page (eg. Full HTML) by having Claro 9.5.10 enabled. In that case, the message "The Classy theme has ckeditor_stylesheets configured without a corresponding ckeditor5-stylesheets configuration. See the change record for details." appeared which is an instance of the PluralTranslatableMarkup class, making that page unusable.

Proposed resolution

Instead of checking for ($message instanceof Markup), we should instead check for ($message instanceof MarkupInterface).

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇬🇷Greece vensires

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

Comments & Activities

Production build 0.71.5 2024