[wp-trac] [WordPress Trac] #36590: POST['nav-menu-data'] breaks other POST values

WordPress Trac noreply at wordpress.org
Wed Apr 20 21:55:55 UTC 2016


#36590: POST['nav-menu-data'] breaks other POST values
-------------------------------------+-------------------------------------
 Reporter:  Unyson                   |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  4.5.1
Component:  Menus                    |     Version:  4.5
 Severity:  normal                   |  Resolution:
 Keywords:  needs-patch needs-       |     Focuses:  javascript,
  testing                            |  administration
-------------------------------------+-------------------------------------

Comment (by keraweb):

 @ericlewis

 {{{array_merge_recursive()}}} won't work because it appends new values.
 You'll need to use {{{array_replace_recursive()}}} to properly add the
 values. (see [https://3v4l.org/tKr5Z this example])

 Also, how does the preg_match compare to a explode performance wise? I've
 understood that a preg_match is a relatively heavy function to use. Not
 sure though :-)

 Also, the current function does the array merge on the whole $_POST value.
 I can imagine with larger menu's this can get slower than to do this
 merge/replace on the first array key that is found. The code has a lot
 less to loop through for every new key that is found.

 Let me know your thoughts!

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


More information about the wp-trac mailing list