@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

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

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.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15373

Differential Revision: https://we.phorge.it/D25207

+3 -1
+3 -1
src/applications/project/controller/PhabricatorProjectMoveController.php
··· 24 24 $ordering = id(clone $ordering) 25 25 ->setViewer($viewer); 26 26 27 + // When the Workboard view is "Group By <something>" the header provides 28 + // that context in JSON form 27 29 $edit_header = null; 28 30 $raw_header = $request->getStr('header'); 29 - if (strlen($raw_header)) { 31 + if (phutil_nonempty_string($raw_header)) { 30 32 $edit_header = phutil_json_decode($raw_header); 31 33 } else { 32 34 $edit_header = array();