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

Deprecation error with php8.1 for Html::escape(NULL)

$
0
0

Problem/Motivation

Something in my site ends up calling Html::escape(NULL), and because the test server is running php8.1 I get a deprecation error which causes general mayhem with the site. I cannot see why this NULL is passed in.

Steps to reproduce

Unknown.

Proposed resolution

Modify the function to be more forgiving of unexpected input:

  public static function escape($text) {
    if (empty($text)) return '';
    return htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
  }

Remaining tasks

If this is a general problem, consider whether other calls (e.g. to entity decode) might also benefit.

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 299620

Latest Images

Trending Articles



Latest Images

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