PHP notice when passing NULL to the TruncateText plugin

Created on 17 April 2023, almost 2 years ago

Problem/Motivation

When a NULL value is passed to the TruncateText plugin, you'll get the following PHP notice logged when using PHP 8.1:

Deprecated function: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Component\Utility\Unicode::truncate()

Steps to reproduce

Have a NULL value and apply the Tamper plugin "truncate_text" on it.

Proposed resolution

Bail out early if the provided data is not a string. Skip applying the Tamper plugin in this case.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇳🇱Netherlands megachriz

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

Comments & Activities

Production build 0.71.5 2024