Make WordPress Core


Ignore:
Timestamp:
06/13/2015 02:59:40 PM (9 years ago)
Author:
wonderboymusic
Message:

In wp_ajax_hidden_columns(), don't explode() on an empty string.
In columns.hidden(), which lives in common.js, don't return items with no id.

This was resulting in options like manageedit-postcolumnshidden containing a serialized array with random empty items.

Props afercia, wonderboymusic.
Fixes #32466.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r32677 r32751  
    13261326function wp_ajax_hidden_columns() {
    13271327    check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
    1328     $hidden = explode( ',', isset( $_POST['hidden'] ) ? $_POST['hidden'] : '' );
    13291328    $page = isset( $_POST['page'] ) ? $_POST['page'] : '';
    13301329
     
    13351334        wp_die( -1 );
    13361335
    1337     if ( is_array($hidden) )
    1338         update_user_option($user->ID, "manage{$page}columnshidden", $hidden, true);
     1336    $hidden = ! empty( $_POST['hidden'] ) ? explode( ',', $_POST['hidden'] ) : array();
     1337    update_user_option( $user->ID, "manage{$page}columnshidden", $hidden, true );
    13391338
    13401339    wp_die( 1 );
Note: See TracChangeset for help on using the changeset viewer.