[wp-trac] [WordPress Trac] #56926: Infinite loop in wp_nav_menu

WordPress Trac noreply at wordpress.org
Fri Nov 18 17:14:05 UTC 2022


#56926: Infinite loop in wp_nav_menu
-------------------------------------------------+-------------------------
 Reporter:  david.binda                          |       Owner:
                                                 |  hellofromTonya
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.1.2
Component:  Menus                                |     Version:  6.1
 Severity:  normal                               |  Resolution:
 Keywords:  reporter-feedback has-patch has-     |     Focuses:
  unit-tests needs-refresh                       |
-------------------------------------------------+-------------------------

Comment (by david.binda):

 I've been finally successful in my attempts to reproduce the issue in
 customizer on a standalone WordPress install on my local machine (using
 VVV environment).

 The reproduction steps are not straightforward, so I have recorded a video
 of the session.

 I haven't dug into the related code, but from my observations, I believe
 that there are 2 issues in the code somewhere, which are resulting in data
 corruption:

 1. removing a menu item with children does not actually remove the parent
 element, but sets it to "display: none" so it's no longer visible, which
 allows a children to be placed at depth of 1 (instead of 0) without
 visible parent
 2. if such an element exists, the computation of the parent in the
 "reorder" functionality, unpon clicking the left arrow, returns the item's
 own ID

 In order to make sure one can follow the reproduction steps in the video
 attached to this comment, here is a summary of the steps in the video:

 1. Create a new menu and assign it to the primary menu location( might not
 be necesary )
 2. Add 3 menu items, where The first one has a single children, and one
 other item is at depth of 0 below the first two items
 3. Save the data
 4. Remove the first item with nested child item, move the child item to
 position of a nested item without parent (this IMHO should not be possible
 and is the bug number one mentioned above)
 5. The items gets displayed below the originally last item of the menu,
 but with wrong parent.
 6. Save the data and refresh the window (the refresh is needed as
 otherwise the left arrow is not enabled)
 7. After refresh, the reorder menu allows one to click the left arrow
 leading to the parent being set to the item's ID.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56926#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list