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

Various PHP 8.1 strlen(null) fixes for Dashboard Panels

Summary:
In the dashboard application (https://my.phorge.site/dashboard/), when creating panels, adding panels to tab panels, and viewing query panels, we get a variety of strlen(null) errors under PHP 8.1.

This fixes all the ones seen.

Fixes T15574

Test Plan: See T15574

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15574

Differential Revision: https://we.phorge.it/D25367
This commit is contained in:
sten 2023-07-29 20:42:49 +01:00
parent 7868ab3754
commit 1720209f16
5 changed files with 6 additions and 5 deletions

View file

@ -32,7 +32,7 @@ final class PhabricatorDashboardAdjustController
$panel_ref = null;
$panel_key = $request->getStr('panelKey');
if (strlen($panel_key)) {
if ($panel_key !== null && strlen($panel_key)) {
$panel_ref = $ref_list->getPanelRef($panel_key);
if (!$panel_ref) {
return new Aphront404Response();

View file

@ -41,12 +41,12 @@ final class PhabricatorDashboardPanelTabsController
$op = $request->getURIData('op');
$after = $request->getStr('after');
if (!strlen($after)) {
if ($after === '') {
$after = null;
}
$target = $request->getStr('target');
if (!strlen($target)) {
if ($target === '') {
$target = null;
}

View file

@ -155,6 +155,7 @@ final class PhabricatorDashboardPanelRenderingEngine extends Phobject {
return $this->renderNormalPanel();
} catch (Exception $ex) {
phlog($ex);
return $this->renderErrorPanel(
$panel->getName(),
pht(

View file

@ -100,7 +100,7 @@ final class PhabricatorDashboardTabsPanelType
$panel_id = idx($tab_spec, 'panelID');
$subpanel = idx($panels, $panel_id);
$name = idx($tab_spec, 'name');
$name = coalesce(idx($tab_spec, 'name'), '');
if (!strlen($name)) {
if ($subpanel) {
$name = $subpanel->getName();

View file

@ -27,7 +27,7 @@ final class PhabricatorFerretSearchEngineExtension
PhabricatorSavedQuery $saved,
array $map) {
if (!strlen($map['query'])) {
if (!(isset($map['query']) && strlen($map['query']))) {
return;
}