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

See #32444.

Built from https://develop.svn.wordpress.org/trunk@32517


git-svn-id: http://core.svn.wordpress.org/trunk@32487 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-05-19 20:50:27 +00:00
parent 5a3dc2a371
commit a69b8b3b91
2 changed files with 6 additions and 4 deletions

View File

@ -65,10 +65,12 @@ class WP_Media_List_Table extends WP_List_Table {
$_total_posts = array_sum($_num_posts) - $_num_posts['trash']; $_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" ); $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)); $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
foreach ( $matches as $type => $reals ) $num_posts = array();
foreach ( $reals as $real ) 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]; $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
}
}
$selected = empty( $_GET['attachment-filter'] ) ? ' selected="selected"' : ''; $selected = empty( $_GET['attachment-filter'] ) ? ' selected="selected"' : '';
$type_links['all'] = "<option value=''$selected>" . sprintf( _nx( 'All (%s)', 'All (%s)', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . '</option>'; $type_links['all'] = "<option value=''$selected>" . sprintf( _nx( 'All (%s)', 'All (%s)', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . '</option>';
foreach ( $post_mime_types as $mime_type => $label ) { foreach ( $post_mime_types as $mime_type => $label ) {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.3-alpha-32516'; $wp_version = '4.3-alpha-32517';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.