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
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
F3284415: D25173.1742775861.diff
Sun, Mar 23, 00:24
F3251845: D25173.1742377712.diff
Tue, Mar 18, 09:48
F3248516: D25173.1742259991.diff
Mon, Mar 17, 01:06
F3220719: D25173.1741813061.diff
Tue, Mar 11, 20:57

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