List Tables: Fix PHP error notice when $columns is null

Use of `register_column_headers()` and `print_column_headers()` creates a `_WP_List_Table_Compat` without any columns. When the List Table object doesn't have any columns, there's naturally no primary column.

Props danielbachhuber.
Fixes #34148.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-11-18 23:01:26 +00:00
parent 68f16dca18
commit a99f7baa5a
2 changed files with 5 additions and 1 deletions

View File

@ -902,6 +902,10 @@ class WP_List_Table {
$columns = $this->get_columns(); $columns = $this->get_columns();
$column = ''; $column = '';
if ( empty( $columns ) ) {
return $column;
}
// We need a primary defined so responsive views show something, // We need a primary defined so responsive views show something,
// so let's fall back to the first non-checkbox column. // so let's fall back to the first non-checkbox column.
foreach ( $columns as $col => $column_name ) { foreach ( $columns as $col => $column_name ) {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-beta4-35697'; $wp_version = '4.4-beta4-35698';
/** /**
* 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.