summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/menu.inc10
1 files changed, 6 insertions, 4 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index a7aa04297..d18490e88 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -1291,7 +1291,7 @@ function menu_set_active_trail($new_trail = NULL) {
}
$tree = menu_tree_page_data(menu_get_active_menu_name());
- $curr = array_shift($tree);
+ list($key, $curr) = each($tree);
while ($curr) {
// Terminate the loop when we find the current path in the active trail.
@@ -1305,7 +1305,7 @@ function menu_set_active_trail($new_trail = NULL) {
$trail[] = $curr['link'];
$tree = $curr['below'];
}
- $curr = array_shift($tree);
+ list($key, $curr) = each($tree);
}
}
// Make sure the current page is in the trail (needed for the page title),
@@ -1709,8 +1709,10 @@ function _menu_find_router_path($menu, $link_path) {
if (!isset($menu[$router_path])) {
list($ancestors) = menu_get_ancestors($parts);
$ancestors[] = '';
- while ($ancestors && (empty($menu[$router_path]))) {
- $router_path = array_shift($ancestors);
+ foreach ($ancestors as $key => $router_path) {
+ if (isset($menu[$router_path])) {
+ break;
+ }
}
}
return $router_path;