PHP 8.1 deprecated function warning

Created on 21 September 2023, about 1 year ago
Updated 26 October 2023, about 1 year ago

Problem/Motivation

When using this module with PHP 8.1 it is possible to trigger a deprecated function warning.

Deprecated function: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in Drupal\filter\Element\ProcessedText::preRenderText()

Steps to reproduce

  • On a Drupal 9 site using PHP 8.1
  • Configure a content type to use the text_summary_formatter formatter
  • Create a node and leave the summary empty
  • The formatter sets '#text' => NULL initially, which will trigger a warning in Drupal\filter\Element\ProcessedText::preRenderText() of the field item does not have a summary

Proposed resolution

Only add a processed_text render array if the summary is populated.

Remaining tasks

  • Review
  • Commit
🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇳🇿New Zealand ericgsmith

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024