[wp-trac] [WordPress Trac] #56876: Dynamic Properties: Fix magic methods in WP_List_Table, WP_User_Query, WP_Text_Diff_Renderer_Table and WP_Admin_Bar classes

WordPress Trac noreply at wordpress.org
Wed Mar 15 21:24:20 UTC 2023


#56876: Dynamic Properties: Fix magic methods in WP_List_Table, WP_User_Query,
WP_Text_Diff_Renderer_Table and WP_Admin_Bar classes
-------------------------------------------------+-------------------------
 Reporter:  antonvlasenko                        |       Owner:
                                                 |  hellofromTonya
     Type:  defect (bug)                         |      Status:  reviewing
 Priority:  normal                               |   Milestone:  6.3
Component:  Administration                       |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests php82       |     Focuses:
  early commit                                   |
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):

 * keywords:  has-patch has-unit-tests php82 early => has-patch has-unit-
     tests php82 early commit


Comment:

 Patch: https://github.com/WordPress/wordpress-develop/pull/4133

 This patch:
 * removes `WP_Admin_Bar::__get()`
 * declares `menu` as a property on the class and initializes it to an
 empty array.
 * removes the unused `proto` dynamic property.

 === Why remove the `proto`?
 tl;dr
 * This property was not intended to be released in 3.1.
 * There are no usages of it in WP.org's plugin or theme directory.
 * There's consensus from @markjaquith @jrf and me that it's safe to remove
 `'proto'`.
 * Plan: Commit early to give time for reports of usages.

 More Details:

 The protocol handling was added during the 3.1 development cycle but its
 usage was removed and switched to use `get_admin_url()`, `admin_url()`,
 etc functions. WP 3.1.0 shipped with the property in the class, but not
 used in Core.

 During the 3.1 development cycle:
 * [16038] added this property to the `WP_Admin_Bar` class and switched it
 to `https://` if SSL in `WP_Admin_Bar::initialize()`.
 * [16077] eliminated its usage in Core, but the property remained in
 `WP_Admin_Bar`.
 * It appears this property was missed in [16077] and should have been
 removed before 3.1 shipped.

 In WP 3.3, [19501] / #19371 introduced the `__get()` magic method for BC
 of `'menu'`:
 [https://core.trac.wordpress.org/ticket/19371#comment:15 Source]
 >making sure that `$this->menu` returns back compat code

 [https://core.trac.wordpress.org/ticket/19371#comment:17 Source]
 >We're not going to maintain compat for $menu. Suggest we make it array()
 and plugins will have to deal. We can throw a `_deprecated_argument()` and
 push them to use the new methods.

 Notice, there's no mention of usages or BC concerns for `'proto'`
 property, but it too was added to the magic method.

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


More information about the wp-trac mailing list