Skip to content

PHP 8.2 support: Add AllowDynamicProperties attribute#164

Merged
macbre merged 2 commits intotrunkfrom
add/allow-dynamic-properties
Nov 6, 2025
Merged

PHP 8.2 support: Add AllowDynamicProperties attribute#164
macbre merged 2 commits intotrunkfrom
add/allow-dynamic-properties

Conversation

@macbre
Copy link
Copy Markdown
Member

@macbre macbre commented Aug 6, 2025

Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

Reference: PHP RFC: Deprecate dynamic properties.

This PR resolves the following deprecation warnings:

 Deprecated: Creation of dynamic property hyperdb::$callback_result is deprecated
 Deprecated: Creation of dynamic property hyperdb::$current_host is deprecated
 Deprecated: Creation of dynamic property hyperdb::$dataset is deprecated
 Deprecated: Creation of dynamic property hyperdb::$dbhname is deprecated
 Deprecated: Creation of dynamic property hyperdb::$lag is deprecated
 Deprecated: Creation of dynamic property hyperdb::$lag_cache_key is deprecated
 Deprecated: Creation of dynamic property hyperdb::$lag_threshold is deprecated
 Deprecated: Creation of dynamic property hyperdb::$last_connection is deprecated
 Deprecated: Creation of dynamic property hyperdb::$last_errno is deprecated
 Deprecated: Creation of dynamic property hyperdb::$table is deprecated

It applies a similar fix as used by the WordPress core:

https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-user.php#L41-L42

#[AllowDynamicProperties]
class WP_User {

Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].

This resolves the following deprecation warnings:

 Deprecated: Creation of dynamic property hyperdb::$callback_result is deprecated
 Deprecated: Creation of dynamic property hyperdb::$current_host is deprecated
 Deprecated: Creation of dynamic property hyperdb::$dataset is deprecated
 Deprecated: Creation of dynamic property hyperdb::$dbhname is deprecated
 Deprecated: Creation of dynamic property hyperdb::$lag is deprecated
 Deprecated: Creation of dynamic property hyperdb::$lag_cache_key is deprecated
 Deprecated: Creation of dynamic property hyperdb::$lag_threshold is deprecated
 Deprecated: Creation of dynamic property hyperdb::$last_connection is deprecated
 Deprecated: Creation of dynamic property hyperdb::$last_errno is deprecated
 Deprecated: Creation of dynamic property hyperdb::$table is deprecated
@macbre macbre requested review from ArSn, aidvu and myhro August 6, 2025 12:06
@macbre macbre self-assigned this Aug 6, 2025
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Aug 6, 2025

Copy link
Copy Markdown

@aidvu aidvu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@macbre macbre merged commit b7127be into trunk Nov 6, 2025
5 checks passed
@macbre macbre deleted the add/allow-dynamic-properties branch November 6, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants