Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293400

Add type declaration to Html::escape(), ::decodeEntities(), and FormattableMarkup::placeholderEscape()

$
0
0

Html::escape() and FormattableMarkup::placeholderEscape() needs a type declaration to prevent it from passing invalid values to htmlspecialchars(). This can only be done in Drupal 10 since it requires union types which are only support in PHP 8.1.

Original report:

Problem/Motivation

I had contrib functional tests failing with

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

This is due to FormattableMarkup replacements being null - those go straight as nulls down to Html::escape() and hence to htmlspecialchars(), where PHP 8.1 complains.

This is not happening in core so no core tests were complaining.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 293400

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>