Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#56511 closed enhancement (duplicate)

PHP 8.2 Deprecated notices

Reported by: dunhakdis's profile dunhakdis Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.0.2
Component: General Keywords:
Focuses: Cc:

Description

Getting the following deprecated issues on PHP 8.2.0-dev

Deprecated: Creation of dynamic property wpdb::$actionscheduler_actions is deprecated in /usr/local/var/www/wordpress/wp-includes/wp-db.php on line 760

Deprecated: Creation of dynamic property wpdb::$actionscheduler_claims is deprecated in /usr/local/var/www/wordpress/wp-includes/wp-db.php on line 760

Deprecated: Creation of dynamic property wpdb::$actionscheduler_groups is deprecated in /usr/local/var/www/wordpress/wp-includes/wp-db.php on line 760

Deprecated: Creation of dynamic property wpdb::$actionscheduler_logs is deprecated in /usr/local/var/www/wordpress/wp-includes/wp-db.php on line 760

Seems like the dynamic creation of properties in class will be deprecated in PHP 8.2 and might be removed in the near future: https://php.watch/versions/8.2/dynamic-properties-deprecated

Adding #[AllowDynamicProperties] removes the deprecated notices.

For example:

<?php
#[AllowDynamicProperties]
class wpdb {
...

Thanks!

Change History (2)

#1 @peterwilsoncc
2 years ago

  • Component changed from Database to General
  • Keywords needs-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi @dunhakdis and welcome to trac!

There are a few tickets for handling the deprecation of dynamic properties in PHP 8.2.

#56034 covers a longer term solution using traits to handle the issue via magic methods.
#56513 was created to add #[AllowDynamicProperties] as a short term fix, a pull request exists for adding these.

I'll close this ticket as a duplicate of #56513 as it includes some of the background discussion on how WordPress intends to handle the deprecation in the short term.

Thanks again for your report.

#2 @dunhakdis
2 years ago

@peterwilsoncc Thanks! 🙌

Note: See TracTickets for help on using tickets.