Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception shown when sending SMS Test Message to Contact Number

Authored by aklapper on Wed, May 10, 17:59.
Referenced Files
Unknown Object (File)
Wed, May 31, 19:18
Unknown Object (File)
Wed, May 31, 06:42
Unknown Object (File)
Tue, May 30, 22:11
Unknown Object (File)
Thu, May 25, 15:14
Unknown Object (File)
Mon, May 22, 01:01



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 T15382

Test Plan

Applied this change and after performing steps to send a test message again, /mail/detail/107/ page got rendered correctly
and I can see the "Status Details" with stuff like "None" or "No mailers are configured."

Diff Detail

rP Phorge
Lint Not Applicable
Tests Not Applicable

Event Timeline

valerio.bozzolan edited the test plan for this revision. (Show Details)

Thanks for this patch, again! :)

I tested this locally, trying multiple pages related to mails, without any nuclear implosion.

Apparently this just generates the Status Details that should always be null or a string. The function phutil_nonempty_string()} will report any alien type like objects, and that is good here.


This revision is now accepted and ready to land.Fri, May 19, 10:54