strlen(): Passing null to parameter #1 when using PHP 8.1

Created on 5 October 2022, about 2 years ago
Updated 20 February 2024, 9 months ago

Problem/Motivation

getCleanSeparators() in AliasCleaner class uses strlen() to check for the length of the string. When config has a value of NULL, the strlen(NULL) check issues a warning in PHP8.1.

Steps to reproduce

Run tests in PHP 8.1

Proposed resolution

Replace 1 line `if (strlen($separator)) {` with `if (!empty($separator)) {`

Using strlen() to check for emptiness is not a good idea anyway - it is not the purpose of this function.

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Needs work

Version

1.11

Component

Code

Created by

🇦🇺Australia alex.skrypnyk Melbourne

Live updates comments and jobs are added and updated live.
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.71.5 2024