From ca090638dabb0084e49e0eb394d692cdb499a87d Mon Sep 17 00:00:00 2001 From: "Fedor A. Fetisov" Date: Fri, 17 Jun 2022 01:59:30 +0300 Subject: [PATCH] Fix PHP 8.1 compatibility issue with the inherited static variable --- .../libs/classes/Mibew/Plugin/AbstractPlugin.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mibew/libs/classes/Mibew/Plugin/AbstractPlugin.php b/src/mibew/libs/classes/Mibew/Plugin/AbstractPlugin.php index 0228320f..ceff4e21 100644 --- a/src/mibew/libs/classes/Mibew/Plugin/AbstractPlugin.php +++ b/src/mibew/libs/classes/Mibew/Plugin/AbstractPlugin.php @@ -42,6 +42,12 @@ abstract class AbstractPlugin */ protected $weight = 0; + /** + * Path to plugin's files + * @var string + */ + private $path = ''; + /** * Default plugin constructor. * @@ -72,9 +78,8 @@ abstract class AbstractPlugin */ public function getFilesPath() { - static $path = false; - if ($path === false) { + if ($this->path === '') { // Get full name of the file with the current plugin class $reflection = new \ReflectionClass($this); $file_path = $reflection->getFileName(); @@ -90,10 +95,10 @@ abstract class AbstractPlugin trim($file_path, DIRECTORY_SEPARATOR) ); array_pop($path_parts); - $path = implode(DIRECTORY_SEPARATOR, $path_parts); + $this->path = implode(DIRECTORY_SEPARATOR, $path_parts); } - return $path; + return $this->path; } /**