If a menu_link entry only has changes within its ['options'], the db_update query may not be invoked.
The issue is in the following logic:

array_intersect_key($item, $existing_item) != $existing_item

The above code will only make a shallow comparison of the two arrays; array keys & values within the 'options' key can be different and the above logic will return FALSE, when TRUE is expected.

Comments

kaidjohnson’s picture

Here's a proposed solution for the problem. By using json_encode, we're flattening the arrays into strings to make a true, fully-recursive comparison. I've opted to use json_encode over serialize for performance reasons (I did some of my own tests on a small scale, http://phpdevblog.niknovo.com/2009/11/serialize-vs-var-export-vs-json-en... seems to back up my findings).

kaidjohnson’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, menu-link-save-recursive-equality-1982992-1.patch, failed testing.

kaidjohnson’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, menu-link-save-recursive-equality-1982992-1.patch, failed testing.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.