Error: Call to a member function __toString() on string in bootstrap_site_alert_preprocess_views_view_fields() (line 93 of modules/contrib/bootstrap_site_alert/bootstrap_site_alert.module).

Created on 17 January 2024, 10 months ago
Updated 25 January 2024, 10 months ago

Problem/Motivation

For some reason, the view is passing empty fields with no authored site alert,
In my case, I made some changes to the view to handle translatable site alerts.

The website encountered an unexpected error. Please try again later.
Error: Call to a member function __toString() on string in bootstrap_site_alert_preprocess_views_view_fields() (line 93 of modules/contrib/bootstrap_site_alert/bootstrap_site_alert.module).
bootstrap_site_alert_preprocess_views_view_fields(Array, 'views_view_fields__bootstrap_site_alert', Array)
call_user_func_array('bootstrap_site_alert_preprocess_views_view_fields', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('views_view_fields__bootstrap_site_alert', Array) (Line: 433)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 46)

Steps to reproduce

I just opened a page with get request and the error appeared.

Proposed resolution

Check the output to force it to be a Markup class to avoid call __toString on empty strings.

๐Ÿ› Bug report
Status

RTBC

Component

Code

Created by

๐Ÿ‡ง๐Ÿ‡ทBrazil aluzzardi Pelotas, RS

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