PHP Deprecated: Creation of dynamic property Storefront_Footer_Bar::
-
While on php 8.2+ the following method is deprecated and gives warnings:
PHP Deprecated: Creation of dynamic property Storefront_Footer_Bar::$plugin_url is deprecated in /var/www/***/web/wp-content/plugins/storefront-footer-bar/storefront-footer-bar.php on line 89
Deprecated: Creation of dynamic property Storefront_Footer_Bar::$plugin_url is deprecated in /var/www/***/web/wp-content/plugins/storefront-footer-bar/storefront-footer-bar.php on line 89
PHP Deprecated: Creation of dynamic property Storefront_Footer_Bar::$plugin_path is deprecated in /var/www/***/web/wp-content/plugins/storefront-footer-bar/storefront-footer-bar.php on line 90
Deprecated: Creation of dynamic property Storefront_Footer_Bar::$plugin_path is deprecated in /var/www/***/web/wp-content/plugins/storefront-footer-bar/storefront-footer-bar.php on line 90Refactoring the code with this addition will fix the warning
? ? public $admin;
? ? public $plugin_url;
? ? public function get_plugin_url() {
? ? ? ? if (self::$plugin_url) {
? ? ? ? return self::$plugin_url;
? ? ? ? }
? ? ? ? self::$plugin_url = plugin_dir_url( FILE );
? ? ? ? return untrailingslashit(self::$plugin_url);
? ? }
? ? public $plugin_path;
? ? public function get_plugin_path() {
? ? ? ? if (self::$plugin_path) {
? ? ? ? return self::$plugin_path;
? ? ? ? }
? ? ? ? self::$plugin_path = plugin_dir_path( FILE );
? ? ? ? return untrailingslashit(self::$plugin_path);
? ? }Please refer https://www.ads-software.com/support/topic/creation-of-dynamic-property-storefront_top_barplugin_url-is-deprecated/ which is the same issue as this and it’s been fixed with this approach.
Hope this gets fixed, thanks!
- You must be logged in to reply to this topic.