Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exceptions which block rendering user page after creation with Welcome Email enabled
ClosedPublic

Authored by aklapper on May 9 2023, 18:24.

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 T15374

Test Plan

Applied these two changes, performed the user creation steps again, and afterwards the user page at /p/user5/ 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 9 2023, 18:24

Thanks again

Tested locally creating an User, sending automatic welcome, sending default welcome, sending custom welcome, no implosions.

sgtm

src/applications/people/mail/PhabricatorPeopleWelcomeMailEngine.php
121

✅ I verified the above line that seems to only receive strings or null.

This is the welcome message wrote by the Administrator, in raw Remarkup string form.

The function phutil_nonempty_string() will report any alien type, like objects, and that is OK here.

128

✅ I verified the above line that seems to only receive strings or null.

This contains the default body that an Administrator can change for custom instructions.

This is the welcome message wrote by the Administrator, in raw Remarkup string form.

The function phutil_nonempty_string() will report any alien type, like objects, and that is OK here.

132–137

(:D)

This revision is now accepted and ready to land.May 10 2023, 06:13