diff --git a/src/applications/dashboard/controller/dashboard/PhabricatorDashboardAdjustController.php b/src/applications/dashboard/controller/dashboard/PhabricatorDashboardAdjustController.php --- a/src/applications/dashboard/controller/dashboard/PhabricatorDashboardAdjustController.php +++ b/src/applications/dashboard/controller/dashboard/PhabricatorDashboardAdjustController.php @@ -32,7 +32,7 @@ $panel_ref = null; $panel_key = $request->getStr('panelKey'); - if (strlen($panel_key)) { + if (phutil_nonempty_string($panel_key)) { $panel_ref = $ref_list->getPanelRef($panel_key); if (!$panel_ref) { return new Aphront404Response(); @@ -42,7 +42,7 @@ } $column_key = $request->getStr('columnKey'); - if (strlen($column_key)) { + if (phutil_nonempty_string($column_key)) { $columns = $ref_list->getColumns(); if (!isset($columns[$column_key])) { return new Aphront404Response(); @@ -52,7 +52,7 @@ $after_ref = null; $after_key = $request->getStr('afterKey'); - if (strlen($after_key)) { + if (phutil_nonempty_string($after_key)) { $after_ref = $ref_list->getPanelRef($after_key); if (!$after_ref) { return new Aphront404Response(); diff --git a/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php b/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php --- a/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php +++ b/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php @@ -15,7 +15,7 @@ // editing. $context_phid = $request->getStr('contextPHID'); - if (strlen($context_phid)) { + if (phutil_nonempty_string($context_phid)) { $context = id(new PhabricatorObjectQuery()) ->setViewer($viewer) ->withPHIDs(array($context_phid)) diff --git a/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelTabsController.php b/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelTabsController.php --- a/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelTabsController.php +++ b/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelTabsController.php @@ -41,12 +41,12 @@ $op = $request->getURIData('op'); $after = $request->getStr('after'); - if (!strlen($after)) { + if (!phutil_nonempty_string($after)) { $after = null; } $target = $request->getStr('target'); - if (!strlen($target)) { + if (!phutil_nonempty_string($target)) { $target = null; } @@ -103,7 +103,7 @@ $context_phid = $request->getStr('contextPHID'); $context = null; - if (strlen($context_phid)) { + if (phutil_nonempty_string($context_phid)) { $context = id(new PhabricatorObjectQuery()) ->setViewer($viewer) ->withPHIDs(array($context_phid)) diff --git a/src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php b/src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php --- a/src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php +++ b/src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php @@ -101,7 +101,7 @@ $subpanel = idx($panels, $panel_id); $name = idx($tab_spec, 'name'); - if (!strlen($name)) { + if ($name === null || !strlen($name)) { if ($subpanel) { $name = $subpanel->getName(); } diff --git a/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php b/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php --- a/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php +++ b/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php @@ -28,7 +28,7 @@ $query = new PhabricatorDashboardPanelQuery(); $raw_query = $this->getRawQuery(); - if (preg_match('/^[wW]\d+\z/', $raw_query)) { + if ($raw_query !== null && preg_match('/^[wW]\d+\z/', $raw_query)) { $id = trim($raw_query, 'wW'); $id = (int)$id; $query->withIDs(array($id));