From 402a63c5de96556b2d5a61566f7245464e2d98a6 Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Fri, 19 May 2023 11:59:23 +0200 Subject: [PATCH] Fix PHP 8.1 "strlen(null)" exception which blocks rendering "Browse Dashboards" dialog Summary: `strlen()` was used in Phabricator to check if a generic value is a non-empty string. But, that function does not accept null anymore since PHP 8.1. Closes T15396 Test Plan: Applied this change (on top of D25179 and D25226) and the "Browse Dashboards" dialog got 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: T15396 Differential Revision: https://we.phorge.it/D25227 --- .../search/compiler/PhutilSearchQueryCompiler.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/applications/search/compiler/PhutilSearchQueryCompiler.php b/src/applications/search/compiler/PhutilSearchQueryCompiler.php index c3f93e16c9..2356a06a8f 100644 --- a/src/applications/search/compiler/PhutilSearchQueryCompiler.php +++ b/src/applications/search/compiler/PhutilSearchQueryCompiler.php @@ -103,7 +103,9 @@ final class PhutilSearchQueryCompiler private function tokenizeQuery($query) { $maximum_bytes = 1024; - + if ($query === null) { + $query = ''; + } $query_bytes = strlen($query); if ($query_bytes > $maximum_bytes) { throw new PhutilSearchQueryCompilerSyntaxException(