[wp-trac] [WordPress Trac] #61890: Handle WP_Term known, named dynamic properties for PHP 8.2

WordPress Trac noreply at wordpress.org
Fri Aug 23 16:20:00 UTC 2024


#61890: Handle WP_Term known, named dynamic properties for PHP 8.2
-------------------------------------+-------------------------------------
 Reporter:  hellofromTonya           |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  6.7
Component:  Taxonomy                 |     Version:  4.4
 Severity:  minor                    |  Resolution:
 Keywords:  php82 has-patch has-     |     Focuses:  coding-standards, php-
  unit-tests needs-testing needs-    |  compatibility
  dev-note                           |
-------------------------------------+-------------------------------------
Changes (by hellofromTonya):

 * keywords:  php82 has-patch has-unit-tests changes-requested => php82 has-
     patch has-unit-tests needs-testing needs-dev-note


Comment:

 There are 2 different solutions available for testing:

 * Declare the known, named dynamic properties and deprecate the getter
 magic method: [https://github.com/WordPress/wordpress-develop/pull/7224
 patch PR 7224].
 * [Preferred] Support dynamic properties - adds full set of magic methods:
 [https://github.com/WordPress/wordpress-develop/pull/7231 patch PR 7231].

 As explained in comment:12, IMO the latter option to support dynamic
 properties is the needed and preferred the approach.

 What's the downside?
 Type casting to an array will no longer return the dynamic properties.
 Extenders will need to modify to use `WP_Term::to_array()`, which has been
 available and is recommended. A dev note will be needed to alert
 extenders. Plus, outreach to
 [https://www.wpdirectory.net/search/01HWR887XBHDYRN6G0E7N0SVZA plugin
 authors] will help to mitigate issues when it ships.

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


More information about the wp-trac mailing list