Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks rendering Pholio mock preview

Authored by aklapper on May 6 2023, 09:52.
Referenced Files
Unknown Object (File)
Wed, May 31, 06:37
Unknown Object (File)
Mon, May 22, 20:54
Unknown Object (File)
Mon, May 22, 07:34
Unknown Object (File)
Wed, May 17, 13:53



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 T15353

Test Plan

Applied this change and /pholio/create/ displayed an image preview after uploading an image file.

Diff Detail

rP Phorge
Lint Not Applicable
Tests Not Applicable

Event Timeline

aklapper requested review of this revision.May 6 2023, 09:52

I tested this patch locally with some fuzzy tests. Obviously without issues since this is an easy-peasy case.

Thanks again



✅ I verified the above line

The $title comes from Aphront#getStr() that always return a string or null.

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

This revision is now accepted and ready to land.Sun, May 7, 09:51