Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks rendering the Home page
ClosedPublic

Authored by aklapper on Apr 29 2023, 20:14.

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 T15296

Test Plan

Applied this change and Home page rendered in web browser.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Tested locally. No nuclear implosions. Thanks!

yesyes

src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php
29

✅ I debugged $name locally with phlog() to verify that it only assumes string or null, for example using the Edit Menu Item and similar stuff with fuzzy data.

The phutil_nonempty_string() will report alien values and that is OK.

This revision is now accepted and ready to land.May 1 2023, 09:05