@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

Fix some PHP 8.1 "strlen(null)" exceptions which block rendering a project page

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 T15313

Test Plan:
Applied these three changes (with D25144, D25145, D25146, D25147, D25151,
D25152, D25153 on top).
Afterwards end up with the unresolved exception covered by T15263.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15313

Differential Revision: https://we.phorge.it/D25163

+3 -3
+3 -3
src/applications/project/state/PhabricatorWorkboardViewState.php
··· 41 41 $this->requestState['filter'] = $request->getStr('filter'); 42 42 } 43 43 44 - if (strlen($request->getURIData('queryKey'))) { 44 + if (phutil_nonempty_string($request->getURIData('queryKey'))) { 45 45 $this->requestState['filter'] = $request->getURIData('queryKey'); 46 46 } 47 47 ··· 169 169 170 170 public function getQueryKey() { 171 171 $request_query = idx($this->requestState, 'filter'); 172 - if (strlen($request_query)) { 172 + if (phutil_nonempty_string($request_query)) { 173 173 return $request_query; 174 174 } 175 175 ··· 203 203 204 204 $default_query = $project->getDefaultWorkboardFilter(); 205 205 206 - if (strlen($default_query)) { 206 + if (phutil_nonempty_string($default_query)) { 207 207 return $default_query; 208 208 } 209 209