Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exceptions which block rendering Auth's Customize Messages page
ClosedPublic

Authored by aklapper on May 1 2023, 21:34.

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 T15325

Test Plan

Applied these three changes and all seven subpages (e.g. /auth/message/user.edit.username/) finally rendered in web browser.

Diff Detail

Repository
rP Phorge
Branch
T15325 (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 328
Build 328: arc lint + arc unit

Event Timeline

aklapper requested review of this revision.May 1 2023, 21:34
aklapper edited the test plan for this revision. (Show Details)

Cover another exception/stacktrace in the same file in this patch

Thanks for your patches again!

Tested locally. No nuclear implosions. I was successfully able to heavily use /auth/message/ with empty/default/custom messages. Everything is OK.

lgtm

src/applications/auth/controller/message/PhabricatorAuthMessageViewController.php
106

✅ I verified with phlog() that this variable is always a string or null.

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

114

✅ I verified with phlog() that this variable is always a string or null.

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

123

✅ I verified with phlog() that this variable is always a string or null.

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

This revision is now accepted and ready to land.May 3 2023, 09:45