From bac87ca2646b93a1db123b95bae5373e5d17b56b Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Fri, 12 May 2023 11:59:38 +0200 Subject: [PATCH] Fix PHP 8.1 "strlen(null)" exception[s] which block rendering "Browse Projects" overlay dialog 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 T15380 Test Plan: Applied these two changes (on top of D25179) and on the task creation page, after clicking the magnifier icon in the "Tags" field, the "Browse Projects" overlay dialog got rendered. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15380 Differential Revision: https://we.phorge.it/D25213 --- .../project/typeahead/PhabricatorProjectDatasource.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/applications/project/typeahead/PhabricatorProjectDatasource.php b/src/applications/project/typeahead/PhabricatorProjectDatasource.php index 5b999a997f..5953f688d2 100644 --- a/src/applications/project/typeahead/PhabricatorProjectDatasource.php +++ b/src/applications/project/typeahead/PhabricatorProjectDatasource.php @@ -83,7 +83,7 @@ final class PhabricatorProjectDatasource } $slug = $proj->getPrimarySlug(); - if (!strlen($slug)) { + if (!phutil_nonempty_string($slug)) { foreach ($proj->getSlugs() as $slug_object) { $slug = $slug_object->getSlug(); if (strlen($slug)) { @@ -132,7 +132,7 @@ final class PhabricatorProjectDatasource ->setPriorityType('proj') ->setClosed($closed); - if (strlen($slug)) { + if (phutil_nonempty_string($slug)) { $proj_result->setAutocomplete('#'.$slug); }