[wp-trac] [WordPress Trac] #61890: Handle WP_Term known, named dynamic properties for PHP 8.2
WordPress Trac
noreply at wordpress.org
Fri Aug 16 19:47:45 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:
Severity: minor | Keywords: php82
Focuses: coding-standards, php-compatibility |
-------------------------------------------------+--------------------
For PHP 8.2+ compatibility, the scope of this ticket is to handle
`WP_Term`'s dynamic properties and its incomplete set of magic methods.
As noted in epic ticket #56034:
>Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2
and are expected to become a fatal error in PHP 9.0, though this last part
is not 100% certain yet.
>
>RFC: https://wiki.php.net/rfc/deprecate_dynamic_properties
== Tasks
=== Identify all of the known, named dynamic properties Core adds and uses
Beyond the `'data'` dynamic property (previously discussed in #58087),
Core adds and uses a lot of other known, named dynamic properties. For
example:
* `wp_tag_cloud()` adds `link` and `id` dynamic properties.
* `_make_cat_compat()` adds `cat_ID`, `category_count`,
`category_description`, `cat_name`, `category_nicename`,
`category_parent`.
A first step is to identify all of the dynamic properties that Core adds
and uses.
=== Determine affects / impacts of the preferred solution
#56034 provides guidance for known, named dynamic properties:
>Declare the property on the (parent) class
Consideration will be needed for how declaring these properties on the
class will affect the usage of the `WP_Term::to_array()` method.
If found to have an unwanted affect, the compatible fields approach (e.g.
`WP_User_Query`) can be explored (see #58897).
**References**:
* The changes are part of #56034, which is the larger Dynamic Properties
proposal and initiative.
* See #58087 for an extensive discussion and contextual history of the
`WP_Term::$data` dynamic property.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61890>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list