Skip to content

Commit 29493f8

Browse files
committed
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 freebsd#1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261] arcanist(head=master, ref.master=df6c315ace5f), phorge(head=master, ref.master=7040bd525764) #0 <freebsd#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/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
1 parent 3f5fcdf commit 29493f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/applications/maniphest/query/ManiphestTaskQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ private function parseCursor($cursor) {
10361036
$parts[] = null;
10371037
}
10381038

1039-
if (!strlen($parts[1])) {
1039+
if (!phutil_nonempty_string($parts[1])) {
10401040
$parts[1] = null;
10411041
}
10421042

0 commit comments

Comments
 (0)