Reproduced from a fresh install:
Create a new book (page 1)
Added pages 2-6 (2 is child of 1, 3 is child of 2...)
Added pages 2b-6b (2b is child of 1, 3b is child of 2b...)
Resulting hierarchy:
1
-2
--3
---4
----5
-----6
-2b
--3b
---4b
----5b
-----6b
Moved 6b to be child of 5
Moved 6 to be child of 5b
Resulting hierarchy:
1
-2
--3
---4
----5
-----6b
-2b
--3b
---4b
-----6
----5b
Note that 6 appears as a child of 4b, not 5b (though it is on the 6th level).
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | level6_bug_1.patch | 3.54 KB | pwolanin |
Comments
Comment #1
pwolanin commentedok, following these exact steps I can reproduce the bug. I'm using PHP 4.4 on OS X, webernet is using XAMPP (PHP 5.2.3), so seems not to be a PHP issue.
So my guess is a 99% liklihood the bug is in function _menu_tree_data(). The render function, menu_tree_output(), is too simple to have a subtle bug.
Comment #2
pwolanin commentedconfirmed that the data coming out of _menu_tree_data() has the wrong structure.
Somehow it seems that 6 is getting set as directly 'below' 4b, while 5b is incorrectly set as a sibling of 4b.
Comment #3
pwolanin commentedok, here's a CLI query result - looks correct:
This query corresponds to viewing "page6" or "5b". Viewing "4b" the menu renders correctly (i.e. "5b" appears to be below "4b").
here's how it looks:
vs the correct structure when 4b is the active link:
Comment #4
pwolanin commentedAh, looking at the query results above gave me the possible solution - we DO need to ORDER BY p6 (or pN where N = MENU_MAX_DEPTH) to insure that all children are returned in a query AFTER their parent.
Starter patch attached. This corrects the problem for me.
Comment #5
pwolanin commentedNote this also explains why the bug appears to be sporadic - it will only be in evidence when a link at depth 6 has a mlid that is less than that of its parent.
I think the patch above should just be considered proof-of-principle for the fix. The real fix will be included in this patch: http://drupal.org/node/154470
Comment #6
pwolanin commented