From 0ccac642b997dab993628bb187dd077388a7d146 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 7 May 2009 16:24:33 +0000 Subject: - Patch #409598 by pwolanin, swentel: fixed problem with content type descriptions not being updated. --- includes/menu.inc | 8 ++++---- modules/menu/menu.test | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/includes/menu.inc b/includes/menu.inc index d9d164c44..1e17b08a3 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -2197,10 +2197,10 @@ function menu_link_save(&$item) { } // If every value in $existing_item is the same in the $item, there is no // reason to run the update queries or clear the caches. We use - // array_diff_assoc() with the $existing_item as the first parameter - // because $item has additional keys left over from the process of building - // the router item. - if (!$existing_item || array_diff_assoc($existing_item, $item)) { + // array_intersect_assoc() with the $item as the first parameter because + // $item may have additional keys left over from building a router entry. + // The intersect removes the extra keys, allowing a meaningful comparison. + if (!$existing_item || (array_intersect_assoc($item, $existing_item)) != $existing_item) { db_update('menu_links') ->fields(array( 'menu_name' => $item['menu_name'], diff --git a/modules/menu/menu.test b/modules/menu/menu.test index 728955ed8..284f55541 100644 --- a/modules/menu/menu.test +++ b/modules/menu/menu.test @@ -61,6 +61,12 @@ class MenuTestCase extends DrupalWebTestCase { $old_title = $item['link_title']; $this->modifyMenuLink($item); $item = menu_link_load($item['mlid']); + // Verify that a change to the description is saved. + $description = $this->randomName(16); + $item['options']['attributes']['title'] = $description; + menu_link_save($item); + $saved_item = menu_link_load($item['mlid']); + $this->assertEqual($description, $saved_item['options']['attributes']['title'], t('Saving an existing link updates the description (title attribute)')); $this->resetMenuLink($item, $old_title); } -- cgit v1.2.3