From 953726d71bfa28f7ab570e9b1bdc8bd53d0bffa0 Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Wed, 3 May 2023 19:01:46 +0200 Subject: [PATCH] Fix PHP 8.1 "strlen(null)" exception which blocks creating a project with an empty Description field 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. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15331 Differential Revision: https://we.phorge.it/D25177 --- .../standard/PhabricatorStandardCustomFieldRemarkup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php index b0b9a3ef8e..54f54c7503 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php @@ -30,7 +30,7 @@ final class PhabricatorStandardCustomFieldRemarkup public function renderPropertyViewValue(array $handles) { $value = $this->getFieldValue(); - if (!strlen($value)) { + if (!phutil_nonempty_string($value)) { return null; }