diff --git a/src/applications/diffusion/controller/DiffusionHistoryController.php b/src/applications/diffusion/controller/DiffusionHistoryController.php --- a/src/applications/diffusion/controller/DiffusionHistoryController.php +++ b/src/applications/diffusion/controller/DiffusionHistoryController.php @@ -50,7 +50,7 @@ // ancestors appropriately, but this would currrently be prohibitively // expensive in the general case. - $show_graph = !strlen($drequest->getPath()); + $show_graph = !phutil_nonempty_string($drequest->getPath()); if ($show_graph) { $history_list ->setParents($history_results['parents']) @@ -98,11 +98,10 @@ $viewer = $this->getViewer(); $repository = $drequest->getRepository(); - $no_path = !strlen($drequest->getPath()); - if ($no_path) { - $header_text = pht('History'); - } else { + if (phutil_nonempty_string($drequest->getPath())) { $header_text = $this->renderPathLinks($drequest, $mode = 'history'); + } else { + $header_text = pht('History'); } $header = id(new PHUIHeaderView()) diff --git a/src/applications/diffusion/query/pathid/DiffusionPathIDQuery.php b/src/applications/diffusion/query/pathid/DiffusionPathIDQuery.php --- a/src/applications/diffusion/query/pathid/DiffusionPathIDQuery.php +++ b/src/applications/diffusion/query/pathid/DiffusionPathIDQuery.php @@ -48,6 +48,9 @@ */ public static function normalizePath($path) { + // Ensure we have a string, not a null. + $path = coalesce($path, ''); + // Normalize to single slashes, e.g. "///" => "/". $path = preg_replace('@[/]{2,}@', '/', $path);