Warning with PHP 8.1: Deprecated function: trim()

Created on 22 February 2022, over 2 years ago
Updated 28 February 2023, over 1 year ago

Problem/Motivation

When displaying content with bLazy enabled, one gets warnings on PHP 8.1

Deprecated function: trim(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\blazy\BlazyManagerBase->getIoSettings() (line 293 of modules/contrib/blazy/src/BlazyManagerBase.php).

Proposed resolution

Patch BlazyManagerBase::getIoSettings() by null-coalescing the trim() argument to an empty string:

    $thold = trim($this->configLoad('io.threshold') ?? "");

Remaining tasks

Convert to patch or merge request.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Fixed

Version

2.6

Component

Code

Created by

🇫🇷France fgm Paris, France

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

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