[PHP 8] trim(): Passing null to parameter of type string is deprecated

Created on 1 February 2023, almost 2 years ago
Updated 7 February 2023, almost 2 years ago

Problem/Motivation

The settings for shurly seem to indicate that the shurly.settings shurly_base config is optional, but the trim assumes it isn't null.
https://git.drupalcode.org/project/shurly/-/blob/8.x-1.x/shurly.module#L633

If it isn't set, a warning is thrown.

Deprecated function: trim(): Passing null to parameter #1 ($string) of type string is deprecated in _shurly_get_shurly_base() (line 633 of modules/contrib/shurly/shurly.module).

Steps to reproduce

Use shurly with PHP 8.1 without configuring the base url.

Proposed resolution

Move the trim inside the empty check?

Remaining tasks

Create an MR for the fix.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States matt_paz

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

Comments & Activities

Production build 0.71.5 2024