Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks creating a project with an empty Description field
ClosedPublic

Authored by aklapper on May 2 2023, 19:22.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 11, 13:32
Unknown Object (File)
Thu, Apr 11, 05:10
Unknown Object (File)
Thu, Apr 11, 00:08
Unknown Object (File)
Wed, Apr 10, 19:05
Unknown Object (File)
Sun, Apr 7, 20:10
Unknown Object (File)
Thu, Apr 4, 12:04
Unknown Object (File)
Mon, Apr 1, 16:37
Unknown Object (File)
Mon, Apr 1, 12:05

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 second half of T15331

Test Plan

Applied these two changes (one in Arcanist, one in Phorge). Project with empty Description field was created and /project/view/projectid/ 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 2 2023, 19:22

Tested locally following the test plan, no implosions, thanks!

yesyes

src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php
33

✅ I logged $value with phlog() and I can confirm it just contains the exact string of the description, or null.

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

This revision is now accepted and ready to land.May 2 2023, 20:44