From 29493f8a5c950548f3b70843c45cb320dad42cde Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Tue, 15 Aug 2023 16:18:28 +0200 Subject: [PATCH] Fix PHP 8.1 "strlen(null)" exception listing >100 task search results 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. ``` EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/src/error/PhutilErrorHandler.php:261] arcanist(head=master, ref.master=df6c315ace5f), phorge(head=master, ref.master=7040bd525764) #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [/src/applications/maniphest/query/ManiphestTaskQuery.php:1039] ``` Closes T15604 Test Plan: Have more than 100 tasks, run a broad search with more than 100 results, try to go to next page of results. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15604 Differential Revision: https://we.phorge.it/D25392 --- src/applications/maniphest/query/ManiphestTaskQuery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php index 9e58728cff..8bbf976564 100644 --- a/src/applications/maniphest/query/ManiphestTaskQuery.php +++ b/src/applications/maniphest/query/ManiphestTaskQuery.php @@ -1036,7 +1036,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { $parts[] = null; } - if (!strlen($parts[1])) { + if (!phutil_nonempty_string($parts[1])) { $parts[1] = null; } -- 2.51.2