woocommerce / storefront-homepage-contact-section

5 stars 4 forks source link

Add Support for Dynamic Properties when Using PHP 8.1.28 or Greater #18

Open ldr2273 opened 5 months ago

ldr2273 commented 5 months ago

Describe the bug

When updating to PHP 8.1.28 or higher, deprecation notices regarding Dynamic Properties are displayed:

PHP Deprecated:  Creation of dynamic property Storefront_Homepage_Contact_Section::$plugin_url is deprecated in /srv/htdocs/wp-content/plugins/storefront-homepage-contact-section/storefront-homepage-contact-section.php on line 85
PHP Deprecated:  Creation of dynamic property Storefront_Homepage_Contact_Section::$plugin_path is deprecated in /srv/htdocs/wp-content/plugins/storefront-homepage-contact-section/storefront-homepage-contact-section.php on line 86

Isolating the problem (mark completed items with an [x]):

To Reproduce

  1. Make sure debugging is true/enabled: https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/
  2. Ensure PHP version is 8.1.28 or higher
  3. Install and activate the plugin
  4. Check logs

Expected behavior

The plugin should be activated without any warnings.

Environment

WordPress 6.5.4 WooCommerce 8.9.3 PHP 8.2 (though it happens at 8.1.28 or higher)

Initially reported in 8254237-zen