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.

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
Branch
emptyProjDesc (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 340
Build 340: arc lint + arc unit

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