From ac4c95169973e742ea768ebd103bb2142c3bdc7d Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Tue, 9 May 2023 18:37:02 +0200 Subject: [PATCH] Fix PHP 8.1 "strlen(null)" exception which blocks dragging a task to a Workboard Column Summary: On a Workboard without any "Group by ", 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 " 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 --- .../project/controller/PhabricatorProjectMoveController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/applications/project/controller/PhabricatorProjectMoveController.php b/src/applications/project/controller/PhabricatorProjectMoveController.php index 1fd8b3c677..7f25905748 100644 --- a/src/applications/project/controller/PhabricatorProjectMoveController.php +++ b/src/applications/project/controller/PhabricatorProjectMoveController.php @@ -24,9 +24,11 @@ final class PhabricatorProjectMoveController $ordering = id(clone $ordering) ->setViewer($viewer); + // When the Workboard view is "Group By " the header provides + // that context in JSON form $edit_header = null; $raw_header = $request->getStr('header'); - if (strlen($raw_header)) { + if (phutil_nonempty_string($raw_header)) { $edit_header = phutil_json_decode($raw_header); } else { $edit_header = array();