Page MenuHomePhorge

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

Authored by aklapper on May 10 2023, 17:59.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 21, 17:06
Unknown Object (File)
Sun, Apr 21, 16:07
Unknown Object (File)
Wed, Apr 17, 06:12
Unknown Object (File)
Thu, Apr 11, 06:17
Unknown Object (File)
Sun, Apr 7, 04:57
Unknown Object (File)
Sat, Apr 6, 05:49
Unknown Object (File)
Mon, Apr 1, 01:38
Unknown Object (File)
Mon, Apr 1, 01:38

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 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

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

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.

sgtm

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