Running this module with Drupal 6.x-dev you see a lot of these PHP warnings:

# notice: Undefined index: attributes in sites/all/modules/menutrails/menutrails.module on line 453.
# notice: Undefined variable: trail_raw in sites/all/modules/menutrails/menutrails.module on line 347.

Comments

sun’s picture

Title: Lots of PHP warnings » $trail_raw undefined PHP notices
Priority: Minor » Normal
Status: Active » Needs review
StatusFileSize
new1.29 KB

The first one should already be fixed in the latest development snapshot.

The second one should be fixed with attached patch.

drewish’s picture

StatusFileSize
new680 bytes

Still seeing:

# notice: Undefined variable: trail_raw in /Users/amorton/Sites/rfy/sites/all/modules/menutrails/menutrails.module on line 344.

I'd go for something even simpler like this.

drewish’s picture

Status: Needs review » Needs work

found another one:

# notice: Undefined variable: menu in /sites/all/modules/menutrails/menutrails.module on line 89.

That one is kind of puzzling:

/**
 * Set Breadcrumbs based on active menu trail.
 */
function menutrails_get_breadcrumbs() {
  $item = menu_get_item();
  if (!$menu) {
    // Give first priority to the selected menu.
    $menu = variable_get('menutrails_menu', FALSE);
    if (!$menu) {
      $menu = db_result(db_query("SELECT menu_name FROM {menu_links} WHERE link_path = '%s' AND module = 'menu'", $item['href']));
    }
  }
  $tree = menu_tree_page_data($menu);
  $crumbs = array(l(t('Home'), '<front>'));
  _menutrails_recurse_crumbs($tree, $item, $crumbs);

  return $crumbs;
}

I guess that should be if (!$item)...?

drewish’s picture

StatusFileSize
new1.37 KB

Finished this up:

	•	notice: Undefined index: 105 in /Library/WebServer/Documents/rfy_hacking/sites/all/modules/menutrails/menutrails.module on line 280.
drewish’s picture

Now seeing:

notice: Undefined variable: menu in /Library/WebServer/Documents/rfy_hacking/sites/all/modules/menutrails/menutrails.module on line 96.
sun’s picture

Status: Needs work » Needs review
StatusFileSize
new2.17 KB

This should hopefully eliminate all PHP notices.

While debugging I found some other bugs for which I'll create separate issues.

drewish’s picture

Status: Needs review » Reviewed & tested by the community

oh, yeah much better.

sun’s picture

Status: Reviewed & tested by the community » Fixed

Yay! Pretty long way for a PHP notices issue 8)

As always, it's a pleasure and fun to work with you! :)

sun’s picture

Title: $trail_raw undefined PHP notices » PHP notices / code clean-up
Status: Fixed » Needs review
StatusFileSize
new4.18 KB

Meh. Found another. And some other scary stuff.

sun’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

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