Index: menu_block.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/menu_block/menu_block.module,v
retrieving revision 1.63
diff -u -p -r1.63 menu_block.module
--- menu_block.module	19 Mar 2010 05:58:15 -0000	1.63
+++ menu_block.module	19 Mar 2010 05:59:41 -0000
@@ -332,22 +341,22 @@ function menu_tree_add_active_path(&$tre
   $menu_item = current($tree);
   $tree_with_trail = menu_tree_page_data($menu_item['link']['menu_name']);
 
-  // To traverse the original tree down the active trail, we use a pointer.
-  $subtree_pointer =& $tree;
+  _menu_tree_add_active_path($tree, $tree_with_trail);
+}
 
-  // Find each key in the active trail.
-  while ($tree_with_trail) {
-    foreach (array_keys($tree_with_trail) AS $key) {
-      if ($tree_with_trail[$key]['link']['in_active_trail']) {
-        // Set the active trail info in the original tree.
-        $subtree_pointer[$key]['link']['in_active_trail'] = TRUE;
-        // Continue in the subtree, if it exists.
-        $tree_with_trail =& $tree_with_trail[$key]['below'];
-        $subtree_pointer =& $subtree_pointer[$key]['below'];
-        break;
-      }
-      else {
-        unset($tree_with_trail[$key]);
+/**
+ * Internal helper function for menu_tree_add_active_path().
+ *
+ * @see menu_tree_add_active_path()
+ */
+function _menu_tree_add_active_path(&$tree, &$tree_with_trail) {
+  foreach (array_keys($tree_with_trail) AS $key) {
+    if ($tree_with_trail[$key]['link']['in_active_trail']) {
+      // Set the active trail info in the original tree.
+      $tree[$key]['link']['in_active_trail'] = TRUE;
+      // Continue in the subtree, if it exists.
+      if (!empty($tree_with_trail[$key]['below'])) {
+        _menu_tree_add_active_path($tree[$key]['below'], $tree_with_trail[$key]['below']);
       }
     }
   }
