Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks dragging a task to a Workboard Column
ClosedPublic

Authored by aklapper on Tue, May 9, 13:31.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 31, 06:40
Unknown Object (File)
Sun, May 28, 03:22
Unknown Object (File)
Thu, May 25, 19:11
Unknown Object (File)
Thu, May 25, 08:41
Unknown Object (File)
Thu, May 25, 05:41
Unknown Object (File)
Mon, May 22, 16:52

Details

Summary

On a Workboard without any "Group by <something>", when moving a Task from a Column
to another, in PHP 8.1 there was a crash caused by a null passed to strlen().

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 T15373

Test Plan

Applied this change and afterwards dragging a Task card to another Column succeeded,
with or without a "Group by <something>" query.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

aklapper requested review of this revision.Tue, May 9, 13:31

Tested locally, with and without "Group By <something>"

Hoping to be useful I expand the test plan, and I add a small inline documentation

Thanks again

sgtm

src/applications/project/controller/PhabricatorProjectMoveController.php
31

✅ I verified that the above line is just null or a string

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

This revision is now accepted and ready to land.Tue, May 9, 16:29

add minor inline documentation

valerio.bozzolan retitled this revision from Fix PHP 8.1 "strlen(null)" exception which blocks dragging a task to a workboard column to Fix PHP 8.1 "strlen(null)" exception which blocks dragging a task to a Workboard Column.Tue, May 9, 16:37
valerio.bozzolan edited the summary of this revision. (Show Details)
valerio.bozzolan edited the test plan for this revision. (Show Details)
This revision was landed with ongoing or failed builds.Tue, May 9, 16:37
This revision was automatically updated to reflect the committed changes.

WHOA I hijacked your description just one millisecond before your land it seems