1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 02:02:41 +01:00

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
This commit is contained in:
Andre Klapper 2023-05-01 22:26:09 +02:00
parent 4d88095f2a
commit dff04ba91d

View file

@ -41,7 +41,7 @@ final class PhabricatorWorkboardViewState
$this->requestState['filter'] = $request->getStr('filter'); $this->requestState['filter'] = $request->getStr('filter');
} }
if (strlen($request->getURIData('queryKey'))) { if (phutil_nonempty_string($request->getURIData('queryKey'))) {
$this->requestState['filter'] = $request->getURIData('queryKey'); $this->requestState['filter'] = $request->getURIData('queryKey');
} }
@ -169,7 +169,7 @@ final class PhabricatorWorkboardViewState
public function getQueryKey() { public function getQueryKey() {
$request_query = idx($this->requestState, 'filter'); $request_query = idx($this->requestState, 'filter');
if (strlen($request_query)) { if (phutil_nonempty_string($request_query)) {
return $request_query; return $request_query;
} }
@ -203,7 +203,7 @@ final class PhabricatorWorkboardViewState
$default_query = $project->getDefaultWorkboardFilter(); $default_query = $project->getDefaultWorkboardFilter();
if (strlen($default_query)) { if (phutil_nonempty_string($default_query)) {
return $default_query; return $default_query;
} }