The parent link detection code in menu.inc is broken, due to bad conversion to DB:TNG. In particular, this breaks breadcrumbs when you have a "hole" in the path hierarchy (ie. you have "/test" and "/test/toto/titi", but no "/test/toto").

    $query = db_select('menu_links');
    // Only links derived from router items should have module == 'system', and
    // we want to find the parent even if it's in a different menu.
    if ($item['module'] == 'system') {
      $query->condition('module', 'system');
    }
    else {
      // If not derived from a router item, we respect the specified menu name.
      $query->condition('menu_name', $item['menu_name']);
    }
    // Find the parent - it must be unique.
    $parent_path = $item['link_path'];
    do {
      $parent = FALSE;
      $parent_path = substr($parent_path, 0, strrpos($parent_path, '/'));
      $query->condition('link_path', $parent_path);
      $query_cnt = $query;
      // Only valid if we get a unique result.
      if ($query_cnt->countQuery()->execute()->fetchField() == 1) {
        $parent = $query->fields('menu_links')->execute()->fetchAssoc();
      }
    } while ($parent === FALSE && $parent_path);

Comments

damien tournoud’s picture

Status: Active » Needs review
StatusFileSize
new3.44 KB

Patch + Test.

Status: Needs review » Needs work

The last submitted patch failed testing.

damien tournoud’s picture

Status: Needs work » Needs review
StatusFileSize
new3.43 KB

The test bot is right...

dries’s picture

Status: Needs review » Fixed

Good catch. Thanks Damien. Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.