Closed (fixed)
Project:
Drupal core
Version:
x.y.z
Component:
menu system
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
7 Apr 2006 at 22:59 UTC
Updated:
24 Apr 2006 at 19:02 UTC
Jump to comment: Most recent file
When a menu item has a negative pid, menu_rebuild() is thrown into an infinite loop. This patch is an easy fix that deletes the unnecessary while loop that causes the problem.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | menu_stop_building_1.patch | 500 bytes | chx |
| #6 | menu_stop_building_0.patch | 485 bytes | chx |
| #5 | menu-infinite-loop.patch | 749 bytes | merlinofchaos |
| #4 | menu_stop_building.patch | 485 bytes | chx |
| menu_inc.patch | 1.41 KB | allie micka |
Comments
Comment #1
chx commentedAllie, please refer to http://drupal.org/node/42388#comment-80806 and tell us how have you achieved such a menu.
Comment #2
hunmonk commentedit looks to me like we can't take out the while loop--wouldn't that cause child menu items to be missed? menu stuff isn't my strength, but it looks to me like the solution would be to move the
unset($new_items[$mid]);outside of the if statement--it doesn't look like anything was being done w/ those kinds of menu items anyways, and this will empty them from the array. anyone?Comment #3
merlinofchaos commentedThose code causes an infinite loop.
This code causes an infinite loop because:
1) publishing, the parent menu for publishing/author and publishing/editor is a MENU_CALLBACK which does not contain MENU_MODIFIABLE_BY_ADMIN. Therefore, it is not considered a 'new item', since it can't be saved to the database. However, it *is* the parent item.
2) The new items loop (line 600, menu.inc) will NOT EXIT if it can't find a saved-to-the-db parent for all items. However, since 'publishing', above, is never saved to the DB, its pid will always be negative.
Crash. Burn.
Comment #4
chx commentedmmm, I like this, reproduce code included and Earl told me in IRC how to fix it. All I needed to do was a little coding and testing. I wish every bug report was solved this easily.
Comment #5
merlinofchaos commentedI think your while loop needs to check that count($new_items) && count($new_items != $old_count).
I came up with this version to try and avoid hitting count() more than necessary.
Comment #6
chx commentedOr this way.
Comment #7
chx commentedWrong version posted.
Comment #8
killes@www.drop.org commentedapplied
Comment #9
laura s commentedThis fixed a problem I was having with 4.7RC2. Wonderful! Thank you!
Comment #10
(not verified) commented