Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks blog creation
ClosedPublic

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

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 T15355

Test Plan

Applied this change and /phame/blog/manage/3/ correctly 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:11

Tested locally, verified that the domain is never a PhutilURI. No implosions.

Thanks

sgtm

src/applications/phame/storage/PhameBlog.php
172

✅ I verified the above line

The variable comes from the string input field "Full Domain URI" in the page /phame/blog/edit/<number>/ and always is null or a string and never an object.

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

This revision is now accepted and ready to land.May 8 2023, 10:13