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

Created on 14 September 2022, over 2 years ago
Updated 16 January 2023, over 2 years 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

RTBC

Version

2.0

Component

Code

Created by

πŸ‡ͺπŸ‡ͺEstonia hkirsman

Live updates comments and jobs are added and updated live.
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.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    I forgot in which project this issue happened and I can't seem to reproduce it anymore. Will report back if I ever encounter it again.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica
  • Status changed to Postponed: needs info almost 2 years ago
  • πŸ‡ΊπŸ‡¦Ukraine Matroskeen πŸ‡ΊπŸ‡¦ Ukraine, Lutsk

    Still waiting for some details that will help to track the root cause of this issue.

  • πŸ‡¨πŸ‡­Switzerland tcrawford

    I am working on a project where this issue has suddenly surfaced after a Drupal 11 update. I am also not sure why we have also redirect_fallback_action of NULL on most node types. To resolve, I have just opened the node type config and resaved.

Production build 0.71.5 2024