PHP8.1 deprecation: str_replace(): Passing null to parameter #3

Created on 7 July 2022, almost 2 years ago
Updated 15 May 2024, 17 days ago

Problem/Motivation

I tried to find related issues in the meta #3220021: [meta] Ensure compatibility of Drupal 9 with PHP 8.1 (as it evolves) โ†’ but failed, sorry if this is a duplicate.
I'm upgrading an inherited project into PHP8.1 and I'm seeing deprecation messages such as

Deprecated function: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in Drupal\filter\Element\ProcessedText::preRenderText() (line 101 of core/modules/filter/src/Element/ProcessedText.php).

Proposed resolution

I haven't really tracked down how NULL gets in there in my scenario, but I wonder if just defaulting to an empty string could make sense here.

This is an instance of PHP 8.1: Passing null to non-nullable internal function parameters is deprecated and if we were to use string casting null is always converted to an empty string.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Filterย  โ†’

Last updated 1 day ago

No maintainer
Created by

๐Ÿ‡ช๐Ÿ‡ธSpain marcoscano Barcelona, Spain

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