From e088947cea72ce5bff4615974587818e5be44de4 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 19 May 2015 20:49:59 +0000 Subject: [PATCH] In `WP_Media_List_Table::get_views()`, declare `$num_posts` explicitly before looping. See #32444. git-svn-id: https://develop.svn.wordpress.org/trunk@32517 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-media-list-table.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/includes/class-wp-media-list-table.php b/src/wp-admin/includes/class-wp-media-list-table.php index 9ebd5c0c7f..7c53ffc0d8 100644 --- a/src/wp-admin/includes/class-wp-media-list-table.php +++ b/src/wp-admin/includes/class-wp-media-list-table.php @@ -65,10 +65,12 @@ class WP_Media_List_Table extends WP_List_Table { $_total_posts = array_sum($_num_posts) - $_num_posts['trash']; $total_orphans = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1" ); $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts)); - foreach ( $matches as $type => $reals ) - foreach ( $reals as $real ) + $num_posts = array(); + foreach ( $matches as $type => $reals ) { + foreach ( $reals as $real ) { $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real]; - + } + } $selected = empty( $_GET['attachment-filter'] ) ? ' selected="selected"' : ''; $type_links['all'] = "'; foreach ( $post_mime_types as $mime_type => $label ) {