[wp-trac] [WordPress Trac] #33854: Make WP_List_Table->get_primary_column_name() public

WordPress Trac noreply at wordpress.org
Mon Sep 14 13:31:25 UTC 2015


#33854: Make WP_List_Table->get_primary_column_name() public
--------------------------------------+-----------------------------
 Reporter:  GregLone                  |       Owner:  wonderboymusic
     Type:  defect (bug)              |      Status:  reopened
 Priority:  normal                    |   Milestone:  4.4
Component:  Administration            |     Version:  4.3
 Severity:  normal                    |  Resolution:
 Keywords:  needs-patch dev-feedback  |     Focuses:  ui
--------------------------------------+-----------------------------
Changes (by nerrad):

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


Comment:

 While I totally dig the value of this change and can understand if it
 stays as is,  I think it'd be useful to try and keep access levels for
 methods consistent between WP versions.  The issue is if plugins extend
 WP_List_Table (and yes I know internally its considered "private" but good
 luck trying to enforce that :) ), and have overridden any methods, then
 when you change the access level that means that fatal errors will start
 getting thrown like this:

 {{{
 PHP Fatal error:  Access level to
 EE_Admin_List_Table::get_primary_column_name() must be public (as in class
 WP_List_Table)
 }}}

 If access levels keep changing, then plugins cannot reliably override
 methods from WP_List_Table.

 One thing that might be beneficial is to have a standard for protected and
 private method names (i.e. `_get_primary_column_name`) and then if a
 request like this comes in one can just create a public getter for it.
 Too late to do here but I still like the idea of doing a public wrapper to
 retrieve the value from the original protected method.

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


More information about the wp-trac mailing list