Skip to content

Commit 1720209

Browse files
committed
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
1 parent 7868ab3 commit 1720209

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

src/applications/dashboard/controller/dashboard/PhabricatorDashboardAdjustController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function handleRequest(AphrontRequest $request) {
3232

3333
$panel_ref = null;
3434
$panel_key = $request->getStr('panelKey');
35-
if (strlen($panel_key)) {
35+
if ($panel_key !== null && strlen($panel_key)) {
3636
$panel_ref = $ref_list->getPanelRef($panel_key);
3737
if (!$panel_ref) {
3838
return new Aphront404Response();

src/applications/dashboard/controller/panel/PhabricatorDashboardPanelTabsController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ public function handleRequest(AphrontRequest $request) {
4141

4242
$op = $request->getURIData('op');
4343
$after = $request->getStr('after');
44-
if (!strlen($after)) {
44+
if ($after === '') {
4545
$after = null;
4646
}
4747

4848
$target = $request->getStr('target');
49-
if (!strlen($target)) {
49+
if ($target === '') {
5050
$target = null;
5151
}
5252

src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php

+1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ public function renderPanel() {
155155

156156
return $this->renderNormalPanel();
157157
} catch (Exception $ex) {
158+
phlog($ex);
158159
return $this->renderErrorPanel(
159160
$panel->getName(),
160161
pht(

src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function renderPanelContent(
100100
$panel_id = idx($tab_spec, 'panelID');
101101
$subpanel = idx($panels, $panel_id);
102102

103-
$name = idx($tab_spec, 'name');
103+
$name = coalesce(idx($tab_spec, 'name'), '');
104104
if (!strlen($name)) {
105105
if ($subpanel) {
106106
$name = $subpanel->getName();

src/applications/search/engineextension/PhabricatorFerretSearchEngineExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function applyConstraintsToQuery(
2727
PhabricatorSavedQuery $saved,
2828
array $map) {
2929

30-
if (!strlen($map['query'])) {
30+
if (!(isset($map['query']) && strlen($map['query']))) {
3131
return;
3232
}
3333

0 commit comments

Comments
 (0)