diff --git a/core/includes/menu.inc b/core/includes/menu.inc
index 006730e..b637cc2 100644
--- a/core/includes/menu.inc
+++ b/core/includes/menu.inc
@@ -1341,6 +1341,7 @@ function menu_build_tree($menu_name, array $parameters = array()) {
  * @see menu_build_tree()
  */
 function _menu_build_tree($menu_name, array $parameters = array()) {
+  global $user;
   // Static cache of already built menu trees.
   $trees = &drupal_static(__FUNCTION__, array());
   $language_interface = language(LANGUAGE_TYPE_INTERFACE);
@@ -1350,7 +1351,7 @@ function _menu_build_tree($menu_name, array $parameters = array()) {
   if (isset($parameters['expanded'])) {
     sort($parameters['expanded']);
   }
-  $tree_cid = 'links:' . $menu_name . ':tree-data:' . $language_interface->langcode . ':' . hash('sha256', serialize($parameters));
+  $tree_cid = 'uid:' . $user->uid . 'links:' . $menu_name . ':tree-data:' . $language_interface->langcode . ':' . hash('sha256', serialize($parameters));
 
   // If we do not have this tree in the static cache, check {cache_menu}.
   if (!isset($trees[$tree_cid])) {
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserAccountLinksTests.php b/core/modules/user/lib/Drupal/user/Tests/UserAccountLinksTests.php
index 6780cf7..ea8caa0 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserAccountLinksTests.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserAccountLinksTests.php
@@ -58,10 +58,19 @@ function testSecondaryMenu() {
 
     // Log out and get the homepage.
     $this->drupalLogout();
-    $this->drupalGet('<front>');
+
+    $this->drupalLogin($this->drupalCreateUser(array('access administration pages', 'administer menu')));
+
+    // Verify that the 'My account' link is enabled.
+    $this->drupalGet('admin/structure/menu/manage/account');
+    $this->assertFieldChecked('edit-links-mlid2-hidden', "The 'My account' link is enabled by default.");
+
+    $this->drupalLogout();
+    $this->drupalGet('node');
 
     // For a logged-out user, expect no secondary links.
     $element = $this->xpath('//ul[@id=:menu_id]', array(':menu_id' => 'secondary-menu'));
+    //debug($element);
     $this->assertEqual(count($element), 0, 'No secondary-menu for logged-out users.');
   }
 
