PHP 8.1 AddressDefaultFormatter::viewElement deprecation

Created on 10 January 2022, almost 3 years ago
Updated 23 December 2023, 12 months ago

Problem/Motivation

On PHP 8.1, when the address default formatter is used if not all the used fields are filled (because they are hidden for example) the following deprecation is triggered:
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).

Proposed resolution

We should ensure the field value is not empty before passing the value to Drupal\Component\Utility\Html::escape().

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇨🇭Switzerland aerzas

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

Merge Requests

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.71.5 2024