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.

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