Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks rendering project's Configure Menu page
ClosedPublic

Authored by aklapper on May 1 2023, 23:01.
Tags
None
Referenced Files
F3310772: D25173.1743196860.diff
Thu, Mar 27, 21:21
F3306621: D25173.1743130184.diff
Thu, Mar 27, 02:49
F3303230: D25173.1743078765.diff
Wed, Mar 26, 12:32
F3302639: D25173.1743069660.diff
Wed, Mar 26, 10:01
F3298921: D25173.1743012067.diff
Tue, Mar 25, 18:01
F3298638: D25173.1743006682.diff
Tue, Mar 25, 16:31
F3298596: D25173.1743005173.diff
Tue, Mar 25, 16:06
F3286025: D25173.1742810002.diff
Sun, Mar 23, 09:53

Details

Summary

strlen() was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts phutil_nonempty_string() as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

Closes T15327

Test Plan

Applied this change (on top of D25166) and /project/1/item/configure/ rendered in web browser.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

aklapper requested review of this revision.May 1 2023, 23:01

Thanks for this patch again!

I tested the $name locally intensively with phlog() to verify that it assumes just null or native string.

The function phutil_nonempty_string() will report any other alien type, and that is OK.

(The errors in the unit tests are totally unrelated and this will be discussed in T15334)

✅ green light and thanks

sgtm

This revision is now accepted and ready to land.May 3 2023, 10:24