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

Created on 5 October 2022, over 1 year ago
Updated 20 February 2024, 4 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.69.0 2024