Make WordPress Core

Changeset 32517


Ignore:
Timestamp:
05/19/2015 08:49:59 PM (9 years ago)
Author:
wonderboymusic
Message:

In WP_Media_List_Table::get_views(), declare $num_posts explicitly before looping.

See #32444.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-media-list-table.php

    r31942 r32517  
    6666        $total_orphans = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1" );
    6767        $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
    68         foreach ( $matches as $type => $reals )
    69             foreach ( $reals as $real )
     68        $num_posts = array();
     69        foreach ( $matches as $type => $reals ) {
     70            foreach ( $reals as $real ) {
    7071                $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
    71 
     72            }
     73        }
    7274        $selected = empty( $_GET['attachment-filter'] ) ? ' selected="selected"' : '';
    7375        $type_links['all'] = "<option value=''$selected>" . sprintf( _nx( 'All (%s)', 'All (%s)', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . '</option>';
Note: See TracChangeset for help on using the changeset viewer.