Skip to content

Commit 6015847

Browse files
committedMay 30, 2023
Addressing some PHP8 incompatibilities - Dashboard
Summary: Using dashboard/panels and addressing PHP8 incompatibilities. Refs T13588 Test Plan: Create a dashboard with multiple panels, including a tabbed panel. Update the tabbed panel to have multiple tabs of content. Try to have a tabbed panel contain itself. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T13588 Differential Revision: https://secure.phabricator.com/D21871
1 parent cf40069 commit 6015847

5 files changed

+9
-9
lines changed
 

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

+3-3
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 (phutil_nonempty_string($panel_key)) {
3636
$panel_ref = $ref_list->getPanelRef($panel_key);
3737
if (!$panel_ref) {
3838
return new Aphront404Response();
@@ -42,7 +42,7 @@ public function handleRequest(AphrontRequest $request) {
4242
}
4343

4444
$column_key = $request->getStr('columnKey');
45-
if (strlen($column_key)) {
45+
if (phutil_nonempty_string($column_key)) {
4646
$columns = $ref_list->getColumns();
4747
if (!isset($columns[$column_key])) {
4848
return new Aphront404Response();
@@ -52,7 +52,7 @@ public function handleRequest(AphrontRequest $request) {
5252

5353
$after_ref = null;
5454
$after_key = $request->getStr('afterKey');
55-
if (strlen($after_key)) {
55+
if (phutil_nonempty_string($after_key)) {
5656
$after_ref = $ref_list->getPanelRef($after_key);
5757
if (!$after_ref) {
5858
return new Aphront404Response();

‎src/applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function handleRequest(AphrontRequest $request) {
1515
// editing.
1616

1717
$context_phid = $request->getStr('contextPHID');
18-
if (strlen($context_phid)) {
18+
if (phutil_nonempty_string($context_phid)) {
1919
$context = id(new PhabricatorObjectQuery())
2020
->setViewer($viewer)
2121
->withPHIDs(array($context_phid))

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

+3-3
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 (!phutil_nonempty_string($after)) {
4545
$after = null;
4646
}
4747

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

@@ -103,7 +103,7 @@ public function handleRequest(AphrontRequest $request) {
103103

104104
$context_phid = $request->getStr('contextPHID');
105105
$context = null;
106-
if (strlen($context_phid)) {
106+
if (phutil_nonempty_string($context_phid)) {
107107
$context = id(new PhabricatorObjectQuery())
108108
->setViewer($viewer)
109109
->withPHIDs(array($context_phid))

‎src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php

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

103103
$name = idx($tab_spec, 'name');
104-
if (!strlen($name)) {
104+
if ($name === null || !strlen($name)) {
105105
if ($subpanel) {
106106
$name = $subpanel->getName();
107107
}

‎src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function buildResults() {
2828
$query = new PhabricatorDashboardPanelQuery();
2929

3030
$raw_query = $this->getRawQuery();
31-
if (preg_match('/^[wW]\d+\z/', $raw_query)) {
31+
if ($raw_query !== null && preg_match('/^[wW]\d+\z/', $raw_query)) {
3232
$id = trim($raw_query, 'wW');
3333
$id = (int)$id;
3434
$query->withIDs(array($id));

0 commit comments

Comments
 (0)
Failed to load comments.