EasyBreadcrumbBuilder::normalizeText() mishandles string "0"

Created on 20 April 2022, over 2 years ago
Updated 19 August 2024, 4 months ago

Problem/Motivation

Introduced by 🐛 PHP 8.1 EasyBreadcrumbBuilder::normalizeText deprecation Fixed .

Steps to reproduce

Proposed resolution

The language construct empty() is a dangerous animal...
Very few users will hit this, but the handling of "0" was changed, and the change looks incorrect.
If the NULL case must be handled, better to handle that and nothing else. I suggest using the comparison operator and doing a strict check for NULL. If "0" and FALSE need to be handled as well, then a DocBlock comment would help. Actually, docs on the NULL handling might help, too. What does it mean if NULL is passed? Is that a normal case or could it indicate a bug elsewhere? Should the next major version throw an exception on NULL or FALSE? (manually or by type declaration usage.)

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

🇳🇱Netherlands Eric_A

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

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