Deprecated function: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated

Created on 14 September 2022, almost 2 years ago
Updated 8 July 2023, 12 months ago

Problem/Motivation

On node edit page I'm seeing this:

Deprecated function: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Component\Utility\Html::escape() (line 424 of core/lib/Drupal/Component/Utility/Html.php).
Drupal\Component\Utility\Html::escape(NULL) (Line: 262)
Drupal\Component\Render\FormattableMarkup::placeholderEscape(NULL) (Line: 208)
Drupal\Component\Render\FormattableMarkup::placeholderFormat('Global @bundle fallback (@setting)', Array) (Line: 195)
Drupal\Core\StringTranslation\TranslatableMarkup->render() (Line: 15)
Drupal\Core\StringTranslation\TranslatableMarkup->__toString() (Line: 448)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 50)
__TwigTemplate_79ab552b3d3c7091a104674cdfbf6f7b->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('core/themes/seven/templates/classy/form/form-element-label.html.twig', Array) (Line: 384)

Steps to reproduce

Open node edit page and check logs.

Proposed resolution

Don't pass null values in t() method.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Postponed: needs info

Version

2.0

Component

Code

Created by

πŸ‡ͺπŸ‡ͺEstonia hkirsman

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024