Issue #3241300 by alexpott: template_preprocess_responsive_image_formatter() causes deprecations on PHP 8.1

merge-requests/1227/head
Lee Rowlands 2021-10-08 15:20:10 +10:00
parent 93e9e36c51
commit 469425a4aa
No known key found for this signature in database
GPG Key ID: 2B829A3DF9204DC4
1 changed files with 1 additions and 1 deletions

View File

@ -106,7 +106,7 @@ function template_preprocess_responsive_image_formatter(&$variables) {
$item = $variables['item'];
$attributes = [];
// Do not output an empty 'title' attribute.
if (mb_strlen($item->title) != 0) {
if (!is_null($item->title) && mb_strlen($item->title) != 0) {
$attributes['title'] = $item->title;
}
$attributes['alt'] = $item->alt;