Make WordPress Core

Ticket #14134: 14134.re-slash.diff

File 14134.re-slash.diff, 948 bytes (added by westonruter, 9 years ago)
  • src/wp-admin/nav-menus.php

    diff --git src/wp-admin/nav-menus.php src/wp-admin/nav-menus.php
    index 7a6a18c..2ab6334 100644
    if ( isset( $_POST['nav-menu-data'] ) ) { 
    5959                foreach ( $data as $post_input_data ) {
    6060                        // For input names that are arrays (e.g. `menu-item-db-id[3]`), derive the array path keys via regex.
    6161                        if ( preg_match( '#(.*)(?:\[(\d+)\])#', $post_input_data->name, $matches ) ) {
    62                                 if ( empty( $_POST[$matches[1]] ) ) {
    63                                         $_POST[$matches[1]] = array();
     62                                if ( empty( $_POST[ $matches[1] ] ) ) {
     63                                        $_POST[ $matches[1] ] = array();
    6464                                }
    65                                 $_POST[$matches[1]][(int)$matches[2]] = $post_input_data->value;
     65                                $_POST[ $matches[1] ][ (int) $matches[2] ] = wp_slash( $post_input_data->value );
    6666                        } else {
    67                                 $_POST[$post_input_data->name] = $post_input_data->value;
     67                                $_POST[ $post_input_data->name ] = wp_slash( $post_input_data->value );
    6868                        }
    6969                }
    7070        }