Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Yet another static cache problem. This time, the menu tree can become stale when inserting multiple book pages in a single request. As the menu tree is stale, children of children can't be inserted:
Example:
Parent
-- Child
-- Child
works but
Parent
-- Child
--- Child
will fail on the last page.
Patches are forthcoming. This affects Drupal 6 as well.
Comments
Comment #1
deviantintegral CreditAttribution: deviantintegral commentedHere are patches for 6.x and 7.x. Any suggestions for appropriate test cases? I could just verify that the cache is accurate after adding menu items, but that seems a little simple.
Also, I currently reset the cache in menu_rebuild(), and then leave it up to the calling code to call menu_rebuild(). I'm guessing that book.module should call that somewhere (it doesn't), but I think that should be a seperate patch as it probably occurs in other modules as well.
Comment #2
svdoord CreditAttribution: svdoord commentedI ran into this problem with my custom module in Drupal 6. The suggested patch fixes my problem, so I hereby vote to have it in the next Drupal 6 release.
Comment #4
deviantintegral CreditAttribution: deviantintegral commentedThis has been dealt with in HEAD over at #422368: convert menu.inc to use new static caching API.
Anyone feel like giving the patch against 6.x another review?
Comment #5
idflood CreditAttribution: idflood commentedI simply added manually the change to the head, the last patch won't add everything.
Comment #6
deviantintegral CreditAttribution: deviantintegral commentedRe-roll looks good; don't want to RTBC it as I created it, but I'm marking as a newbie-friendly patch as it's a fairly simple and clear change.
Comment #7
deviantintegral CreditAttribution: deviantintegral commentedHere is a reroll to sync against DRUPAL-6.
Comment #9
mark.lindsey CreditAttribution: mark.lindsey commentedI am also running into this static caching issue.
The attached patch adds a reset parameter to menu_tree_all_data() so you can refresh the cached storage of a particular menu. This is not an issue in D7 because menu_tree_all_data() uses the drupal_static API. However, this bug still affects D6.
Comment #10
mark.lindsey CreditAttribution: mark.lindsey commentedBump. Is this something that will be addressed?