Changeset 36852 for trunk/src/wp-admin/nav-menus.php
- Timestamp:
- 03/05/2016 12:46:45 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/nav-menus.php
r36613 r36852 52 52 /* 53 53 * If a JSON blob of navigation menu data is found, expand it and inject it 54 * into `$_POST` to avoid PHP `max_input_vars` limitations. See #14134. 54 * into `$_POST` to avoid PHP `max_input_vars` limitations. See #14134. 55 55 */ 56 56 if ( isset( $_POST['nav-menu-data'] ) ) { … … 59 59 foreach ( $data as $post_input_data ) { 60 60 // For input names that are arrays (e.g. `menu-item-db-id[3]`), derive the array path keys via regex. 61 if ( preg_match( '#(.*) (?:\[(\d+)\])#', $post_input_data->name, $matches ) ) {61 if ( preg_match( '#(.*)\[(\w+)\]#', $post_input_data->name, $matches ) ) { 62 62 if ( empty( $_POST[ $matches[1] ] ) ) { 63 63 $_POST[ $matches[1] ] = array(); 64 64 } 65 $_POST[ $matches[1] ][ (int) $matches[2] ] = wp_slash( $post_input_data->value ); 65 // Cast input elements with a numeric array index to integers. 66 if ( is_numeric( $matches[2] ) ) { 67 $matches[2] = (int) $matches[2]; 68 } 69 $_POST[ $matches[1] ][ $matches[2] ] = wp_slash( $post_input_data->value ); 66 70 } else { 67 71 $_POST[ $post_input_data->name ] = wp_slash( $post_input_data->value );
Note: See TracChangeset
for help on using the changeset viewer.