From cdda74ef93f3a18b3653231b1cb89829d088fad7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 15 Apr 2020 12:50:53 +0100 Subject: [PATCH] PluginDescription: use result of phpversion() to check if extension is loaded technically phpstan should account for this with the extension_loaded() check, but it currently doesn't and it's not worth fighting with it when the fix is so simple anyway. --- src/pocketmine/plugin/PluginDescription.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/plugin/PluginDescription.php b/src/pocketmine/plugin/PluginDescription.php index e604dfd06..10db86877 100644 --- a/src/pocketmine/plugin/PluginDescription.php +++ b/src/pocketmine/plugin/PluginDescription.php @@ -28,7 +28,6 @@ use function array_map; use function array_values; use function constant; use function defined; -use function extension_loaded; use function is_array; use function phpversion; use function preg_match; @@ -230,11 +229,11 @@ class PluginDescription{ */ public function checkRequiredExtensions(){ foreach($this->extensions as $name => $versionConstrs){ - if(!extension_loaded($name)){ + $gotVersion = phpversion($name); + if($gotVersion === false){ throw new PluginException("Required extension $name not loaded"); } - $gotVersion = phpversion($name); foreach($versionConstrs as $constr){ // versionConstrs_loop if($constr === "*"){ continue;