[wp-trac] [WordPress Trac] #34148: PHP notice in class WP_List_Table using register_column_headers (_WP_List_Table_Compat)

WordPress Trac noreply at wordpress.org
Wed Nov 4 19:16:49 UTC 2015


#34148: PHP notice in class WP_List_Table using register_column_headers
(_WP_List_Table_Compat)
----------------------------+-----------------------------
 Reporter:  Hax             |       Owner:  wonderboymusic
     Type:  defect (bug)    |      Status:  reopened
 Priority:  normal          |   Milestone:  4.4
Component:  Administration  |     Version:  4.3
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:  administration
----------------------------+-----------------------------
Changes (by JustinSainton):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Happy to open a new ticket if necessary, but r34897, which closed this
 ticket, seems insufficient.  Alternatively, I'm just doing something
 wrong.

 Having encountered the bug, exactly as reported initially, and now running
 the latest nightly, I get this PHP warning instead:

 `Warning: Invalid argument supplied for foreach() in /srv/www/wordpress-
 default/wp-admin/includes/class-wp-list-table.php on line 907`

 Line 907 is where `$columns` is looped through inside the
 `get_default_primary_column_name()` method.  That variable here is
 `$this->get_columns()`, which returns NULL on a backtrace inside of the
 `get_default_primary_column_name()`.

 When I check the backtrace inside of
 `_WP_List_Table_Compat->get_columns()`, it looks like this method actually
 runs twice, as it returns two backtraces.  The first returns the expected
 array of columns. The second returns NULL.  Below are the backtraces with
 the first few layers (which are identical) removed.


 {{{
 string(583) "print_column_headers, WP_List_Table->print_column_headers,
 _WP_List_Table_Compat->get_column_info, get_column_headers,
 apply_filters('manage_wpsc_purchase_log_item_details_columns'),
 call_user_func_array, _WP_List_Table_Compat->get_columns" array(7) {
 ["title"]=> string(4) "Name" ["sku"]=> string(3) "SKU" ["quantity"]=>
 string(8) "Quantity" ["price"]=> string(5) "Price" ["shipping"]=>
 string(13) "Item Shipping" ["tax"]=> string(8) "Item Tax" ["total"]=>
 string(10) "Item Total" }

 string(525) "print_column_headers, WP_List_Table->print_column_headers,
 _WP_List_Table_Compat->get_column_info,
 WP_List_Table->get_default_primary_column_name,
 _WP_List_Table_Compat->get_columns" NULL


 Warning: Invalid argument supplied for foreach() in /srv/www/wordpress-
 default/wp-admin/includes/class-wp-list-table.php on line 907

 }}}

 Still dinking around to see what I can find and potentially resolve here -
 as mentioned, it's entirely possible we're just doing something wrong
 (something, of course, aside from even using
 register/print_column_headers())

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34148#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list