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.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 30, 06:18
Unknown Object (File)
Sun, Apr 14, 10:56
Unknown Object (File)
Sun, Apr 14, 10:50
Unknown Object (File)
Sun, Apr 14, 10:34
Unknown Object (File)
Sun, Apr 14, 09:14
Unknown Object (File)
Sun, Apr 14, 08:06
Unknown Object (File)
Thu, Apr 11, 05:25
Unknown Object (File)
Apr 1 2024, 02:40

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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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