[wp-trac] [WordPress Trac] #41502: _wp_expand_nav_menu_post_data() corrupts multiple select (array value)
WordPress Trac
noreply at wordpress.org
Tue Aug 1 04:01:04 UTC 2017
#41502: _wp_expand_nav_menu_post_data() corrupts multiple select (array value)
--------------------------+-----------------------------
Reporter: elliotcondon | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Hi guys.
Elliot here - ACF developer.
I've recently added custom fields to the WP menu and WP menu item forms.
In doing so, i have discovered that the `_wp_expand_nav_menu_post_data()`
function (called in wp-admin/nav-menus.php on line 56) is corrupting some
array $_POST values.
The issue is caused with inputs using a name like so:
`my_field[]`
`my_field[]`
Please note that there is no issue when a key is defined like so:
`my_field[0]`
`my_field[1]`
There are many cases where a developer would not define the 'keys' of an
'array type' input name. Think of a multiple select element. The element
accepts only one name attribute and it must be defined like so
`my_field[]`.
- Also, checkbox / radio fields are commonly rendered using the same
naming style.
Is it possible to request some extra logic within the
`_wp_expand_nav_menu_post_data()` function that allows for this?
I suspect the issue is caused on line 1125 of the 'wp-admin/includes/nav-
menu.php' file where the $_POST value is modified:
`$new_post_data[ $array_bits[ $i ] ] = wp_slash( $post_input_data->value
);`
Thanks
Elliot
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41502>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list