diff --git a/lib/classes/navigation/output/primary.php b/lib/classes/navigation/output/primary.php index f55dc8c8c4f..e1f36780bd3 100644 --- a/lib/classes/navigation/output/primary.php +++ b/lib/classes/navigation/output/primary.php @@ -194,12 +194,15 @@ class primary implements renderable, templatable { $current = parse_url($FULLME ?? ''); $pathmatches = false; + // Exact match of the path of node and current url. - if ($nodeurl['path'] === $current['path']) { + $nodepath = $nodeurl['path'] ?? '/'; + $currentpath = $current['path'] ?? '/'; + if ($nodepath === $currentpath) { $pathmatches = true; } // The current url may be trailed by a index.php, otherwise it's the same as the node path. - if (!$pathmatches && $nodeurl['path'] . 'index.php' === $current['path']) { + if (!$pathmatches && $nodepath . 'index.php' === $currentpath) { $pathmatches = true; } // No path did match, so the node can't be active.