Opened 10 months ago
Last modified 10 months ago
#62863 new enhancement
_make_cat_compat() - dynamic properties deprecated in PHP 8.2
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | 4.4 |
| Component: | Taxonomy | Keywords: | has-patch |
| Focuses: | php-compatibility | Cc: |
Description
Follow up to #62842
As mentioned, in PHP 8.2, the definition of dynamic properties will throw a deprecation error. While WP_Term has #[AllowDynamicProperties] allowed, I still propose to enhance this.
https://php.watch/versions/8.2/dynamic-properties-deprecated
The function is used a total of 16 times throughout core.
Since _make_cat_compat() just dynamically defines copies existing properties of WP_Term, I think instead of adding dynamic properties, the use
By enhancing WP_Term with __get() and __set() object we could make full aliases instead of copies.
I'll open a PR with a proposal.
cc @audrasjb
Change History (2)
Note: See
TracTickets for help on using
tickets.
This proposes a replacement of dynamic properties as in
_make_cat_compat()Refs: #62863
Trac ticket: https://core.trac.wordpress.org/ticket/62863#ticket