In some kind of situations that I could not determine, the item in _custom_breadcrumbs_menu_subtree($item) is empty which results in warnings thrown by the loop.
Of course, adding a condition will fix that, but I am not sure that the item should be empty in the first place.

function _custom_breadcrumbs_menu_subtree($item) {
  static $index = array();
  static $indexed = array();
  // This looks expensive, but menu_tree_all_data uses static caching.
  $tree = menu_tree_all_data($item['menu_name']);
  if (!isset($indexed[$item['menu_name']])) {
    $index += _custom_breadcrumbs_menu_index($tree);
    $indexed[$item['menu_name']] = TRUE;
  }
  // Traverse the tree.
  foreach ($index[$item['mlid']]['parents'] as $mlid) { // throwing warnings
    $key = $index[$mlid]['key'];
    if (!isset($tree[$key])) {
      return array();
    }
    $tree = $tree[$key]['below'];
  }
  $key = $index[$item['mlid']]['key'];
  return isset($tree[$key]) ? $tree[$key]['below'] : array();
}

Comments

lamp5’s picture

Issue summary: View changes
Status: Active » Closed (outdated)