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.

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

sgtm

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