1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 08:12:40 +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_ref = null;
$panel_key = $request->getStr('panelKey'); $panel_key = $request->getStr('panelKey');
if (strlen($panel_key)) { if ($panel_key !== null && strlen($panel_key)) {
$panel_ref = $ref_list->getPanelRef($panel_key); $panel_ref = $ref_list->getPanelRef($panel_key);
if (!$panel_ref) { if (!$panel_ref) {
return new Aphront404Response(); return new Aphront404Response();

View file

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

View file

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

View file

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

View file

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