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

WordPress Trac noreply at wordpress.org
Thu Apr 21 12:43:59 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-testing has-patch  |     Focuses:  javascript,
  has-unit-tests                     |  administration
-------------------------------------+-------------------------------------

Comment (by keraweb):

 @ericlewis ,

 Looks good!

 > I think here the preg_match() gives us a bit of readability without
 notable decline in perf.

 Did some testing with your preg_match vs an explode. You're right,
 performance wise the difference is almost non-existend.

 > We'll have to merge onto the $_POST global because we're dealing with
 one POST variable at a time, which could represent a nested key (e.g.
 a[1][2][3]) and the next could be a deep-sibling of the previous (e.g.
 a[1][2][4]).

 Why not only merge/replace from the key we're in and leave the other keys
 be?
 {{{$_POST[ $key ] = array_replace_recursive( $_POST[ $key ],
 $new_post_data[ $key ] ))}}}


 Anyhow, code works for me!

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


More information about the wp-trac mailing list