Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks creating a blog post

Authored by aklapper on May 6 2023, 10:34.
Referenced Files
Unknown Object (File)
Wed, May 31, 06:38
Unknown Object (File)
Tue, May 23, 21:20
Unknown Object (File)
Mon, May 22, 07:14
Unknown Object (File)
Sun, May 21, 11:12
Unknown Object (File)
Tue, May 16, 18:43



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 T15357

Test Plan

Applied this change and created blog post at /phame/post/view/3/blogpost/ rendered in web browser.

Diff Detail

rP Phorge
Lint Not Applicable
Tests Not Applicable

Event Timeline

aklapper requested review of this revision.May 6 2023, 10:34

Tested also this one, thanks

No implosions



✅ I verified the above line

The line was split so to make the linter happy.

I verified that $blog->getDomain() is never a PhutilURI but always is null or a string provided by the user.

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

This revision is now accepted and ready to land.Mon, May 8, 10:15