diff -crB context_original/context.install context_mlid_change/context.install
*** context_original/context.install	2011-06-10 22:41:01.000000000 -0700
--- context_mlid_change/context.install	2011-06-11 12:56:10.000000000 -0700
***************
*** 363,365 ****
--- 363,423 ----
      }
    }
  }
+ 
+ /**
+  * Update menu and breadcrumb context to add mlid with the path for when there
+  * are menu items with the same path.
+  */
+ function context_update_6305() {
+   if (db_table_exists('context')) {
+     $results = db_query("SELECT * FROM {context}");
+     while ($context = db_fetch_array($results)) {
+       $context['reactions'] = context_update_6305_add_mlids($context['reactions']);
+       $context['conditions'] = context_update_6305_add_mlids($context['conditions']);
+       $sql = "UPDATE {context} SET conditions = '%s', reactions = '%s' WHERE name = '%s'";
+       $success = db_query($sql, $context['conditions'], $context['reactions'], $context['name']);
+       if ($success) {
+         drupal_set_message(t('Updated context @name successfully.', array('@name' => $context['name'])));
+       }
+       else {
+         drupal_set_message(t('Unable to update context @name.', array('@name' => $context['name'])));
+       }
+     }
+     drupal_set_message(t("Don't forget to clear all caches."));
+   }
+ }
+ 
+ /**
+  * Helper function to go through all the context data and convert breadcrumb and 
+  * menu paths into mlids.
+  */
+ function context_update_6305_add_mlids($data) {
+ 
+   // get the current paths
+   $paths = array();
+   $data = unserialize($data);
+   foreach ($data as $key => $value) {
+     if (in_array($key, array('breadcrumb', 'menu')) && ! is_numeric($value)) {
+       $paths[] = $value;
+     }
+   }
+ 
+   // find the matching mlids
+   $mlids = array();
+   $results = db_query("SELECT mlid, link_path FROM {menu_links} WHERE link_path in (".db_placeholders($paths, 'text').") AND module = 'menu'", $paths);
+   while ($row = db_fetch_object($results)) {
+     $mlids[$row->link_path] = $row->mlid;
+   }
+ 
+   // save the new mlids
+   $new_data = array();
+   foreach ($data as $key => $value) {
+     if (in_array($key, array('breadcrumb', 'menu')) && ! is_numeric($value)) {
+       if (isset($mlids[$value]) && ! empty($mlids[$value])) {
+         $value = sprintf('%s|%d', $value, $mlids[$value]); // [path]|[mlid]
+       }
+     }
+     $new_data[$key] = $value;
+   }
+   return serialize($new_data);
+ }
diff -crB context_original/plugins/context_condition_menu.inc context_mlid_change/plugins/context_condition_menu.inc
*** context_original/plugins/context_condition_menu.inc	2011-06-10 22:41:01.000000000 -0700
--- context_mlid_change/plugins/context_condition_menu.inc	2011-06-11 12:56:10.000000000 -0700
***************
*** 18,24 ****
        }
        else {
          $link = menu_link_load($id[1]);
!         $identifier = $link['link_path'];
          $root_menu = $root_menus[$id[0]];
          while (isset($menus[$root_menu][$identifier])) {
            $identifier .= "'";
--- 18,24 ----
        }
        else {
          $link = menu_link_load($id[1]);
!         $identifier = sprintf('%s|%d', $link['link_path'], $link['mlid']);
          $root_menu = $root_menus[$id[0]];
          while (isset($menus[$root_menu][$identifier])) {
            $identifier .= "'";
diff -crB context_original/plugins/context_reaction_breadcrumb.inc context_mlid_change/plugins/context_reaction_breadcrumb.inc
*** context_original/plugins/context_reaction_breadcrumb.inc	2011-06-10 22:41:01.000000000 -0700
--- context_mlid_change/plugins/context_reaction_breadcrumb.inc	2011-06-11 12:56:10.000000000 -0700
***************
*** 9,18 ****
     * Override of execute().
     */
    function execute(&$vars = NULL) {
!     if ($active_paths = $this->get_active_paths()) {
        $breadcrumb = array(l(t('Home'), '<front>', array('purl' =>array('disabled' => TRUE))));
!       foreach ($active_paths as $path) {
!         $result = db_query("SELECT p1, p2, p3, p4, p5, p6, p7, p8 FROM {menu_links} WHERE hidden = 0 AND link_path = '%s'", $path);
          while ($parents = db_fetch_array($result)) {
            $set = FALSE;
            foreach (array_filter($parents) as $plid) {
--- 9,18 ----
     * Override of execute().
     */
    function execute(&$vars = NULL) {
!     if ($active_mlids = $this->get_active_mlids()) {
        $breadcrumb = array(l(t('Home'), '<front>', array('purl' =>array('disabled' => TRUE))));
!       foreach ($active_mlids as $mlid) {
!         $result = db_query("SELECT p1, p2, p3, p4, p5, p6, p7, p8 FROM {menu_links} WHERE hidden = 0 AND mlid = %d", $mlid);
          while ($parents = db_fetch_array($result)) {
            $set = FALSE;
            foreach (array_filter($parents) as $plid) {
diff -crB context_original/plugins/context_reaction_menu.inc context_mlid_change/plugins/context_reaction_menu.inc
*** context_original/plugins/context_reaction_menu.inc	2011-06-10 22:41:01.000000000 -0700
--- context_mlid_change/plugins/context_reaction_menu.inc	2011-06-11 12:56:10.000000000 -0700
***************
*** 18,24 ****
        }
        else {
          $link = menu_link_load($id[1]);
!         $identifier = $link['link_path'];
          $root_menu = $root_menus[$id[0]];
          while (isset($menus[$root_menu][$identifier])) {
            $identifier .= "'";
--- 18,24 ----
        }
        else {
          $link = menu_link_load($id[1]);
!         $identifier = sprintf('%s|%d', $link['link_path'], $link['mlid']);
          $root_menu = $root_menus[$id[0]];
          while (isset($menus[$root_menu][$identifier])) {
            $identifier .= "'";
***************
*** 59,72 ****
      $vars['secondary_links'] = $this->menu_set_active($vars['secondary_links']);
    }
  
    function get_active_paths() {
!     $active_paths = array();
      foreach ($this->get_contexts() as $context) {
        if (isset($context->reactions[$this->plugin])) {
!         $active_paths[] = $context->reactions[$this->plugin];
        }
      }
!     return $active_paths;
    }
  
    /**
--- 59,91 ----
      $vars['secondary_links'] = $this->menu_set_active($vars['secondary_links']);
    }
  
+   function get_active_mlids() {
+     return $this->get_active_items('mlid');
+   }
+ 
    function get_active_paths() {
!     return $this->get_active_items('path');
!   }
! 
!   function get_active_items($type) {
!     $active_items = array();
      foreach ($this->get_contexts() as $context) {
        if (isset($context->reactions[$this->plugin])) {
!         $tmp = explode('|', $context->reactions[$this->plugin]);
!         if (! empty($tmp)) {
!           if ($type == 'path' && ! empty($tmp[0])) {
!             $item = $tmp[0];
!           }
!           else if ($type == 'mlid' && ! empty($tmp[1])) {
!             $item = $tmp[1];
!           }
!           if (! empty($item)) {
!             $active_items[$item] = $item;
!           }
!         }
        }
      }
!     return $active_items;
    }
  
    /**
