1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 02:02:41 +01:00

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
This commit is contained in:
Andre Klapper 2023-05-09 18:37:02 +02:00
parent 8d2b481bb5
commit ac4c951699

View file

@ -24,9 +24,11 @@ final class PhabricatorProjectMoveController
$ordering = id(clone $ordering) $ordering = id(clone $ordering)
->setViewer($viewer); ->setViewer($viewer);
// When the Workboard view is "Group By <something>" the header provides
// that context in JSON form
$edit_header = null; $edit_header = null;
$raw_header = $request->getStr('header'); $raw_header = $request->getStr('header');
if (strlen($raw_header)) { if (phutil_nonempty_string($raw_header)) {
$edit_header = phutil_json_decode($raw_header); $edit_header = phutil_json_decode($raw_header);
} else { } else {
$edit_header = array(); $edit_header = array();