WordPress.org

Make WordPress Core

Ticket #27770: 27770.diff

File 27770.diff, 1.1 KB (added by jdgrimes, 3 years ago)

Unslashes widget IDs in Ajax callbacks

  • src/wp-admin/includes/ajax-actions.php

     
    18791879        // Save widgets order for all sidebars.
    18801880        if ( is_array($_POST['sidebars']) ) {
    18811881                $sidebars = array();
    1882                 foreach ( $_POST['sidebars'] as $key => $val ) {
     1882                foreach ( wp_unslash( $_POST['sidebars'] ) as $key => $val ) {
    18831883                        $sb = array();
    18841884                        if ( !empty($val) ) {
    18851885                                $val = explode(',', $val);
     
    19351935        /** This action is documented in wp-admin/widgets.php */
    19361936        do_action( 'sidebar_admin_setup' );
    19371937
    1938         $id_base = $_POST['id_base'];
    1939         $widget_id = $_POST['widget-id'];
     1938        $id_base = wp_unslash( $_POST['id_base'] );
     1939        $widget_id = wp_unslash( $_POST['widget-id'] );
    19401940        $sidebar_id = $_POST['sidebar'];
    19411941        $multi_number = !empty($_POST['multi_number']) ? (int) $_POST['multi_number'] : 0;
    19421942        $settings = isset($_POST['widget-' . $id_base]) && is_array($_POST['widget-' . $id_base]) ? $_POST['widget-' . $id_base] : false;