[wp-trac] [WordPress Trac] #62863: _make_cat_compat() - dynamic properties deprecated in PHP 8.2

WordPress Trac noreply at wordpress.org
Sat Jan 25 10:03:39 UTC 2025


#62863: _make_cat_compat() - dynamic properties deprecated in PHP 8.2
-------------------------------+-----------------------------
 Reporter:  apermo             |      Owner:  (none)
     Type:  enhancement        |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Taxonomy           |    Version:  4.4
 Severity:  normal             |   Keywords:
  Focuses:  php-compatibility  |
-------------------------------+-----------------------------
 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

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62863>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list