Make WordPress Core

Opened 21 months ago

Last modified 21 months ago

#62863 new enhancement

_make_cat_compat() - dynamic properties deprecated in PHP 8.2

Reported by: apermo Owned by:
Priority: normal Milestone: Awaiting Review
Component: Taxonomy Version: 4.4
Severity: normal Keywords: has-patch
Cc: Focuses: php-compatibility

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)

This ticket was mentioned in ​PR #8191 on ​WordPress/wordpress-develop by ​@apermo.


21 months ago
#1

  • Keywords has-patch added

This proposes a replacement of dynamic properties as in _make_cat_compat()

Refs: #62863

Trac ticket: https://core.trac.wordpress.org/ticket/62863#ticket

​@apermo commented on ​PR #8191:


21 months ago
#2

If we agree upon this, _make_cat_compat() will likely need additional refactoring, thus just a draft.

Note: See TracTickets for help on using tickets.