Page MenuHomePhorge

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

Authored by aklapper on May 6 2023, 10:34.

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 T15357

Test Plan

Applied this change and created blog post at /phame/post/view/3/blogpost/ 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 6 2023, 10:34

Tested also this one, thanks

No implosions

sgtm

src/applications/phame/storage/PhamePost.php
70–72

✅ 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.May 8 2023, 10:15