From 0793e7e094cdeb431939f1fe2934f81ae6c7473b Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 8 Dec 2021 20:08:53 +0000 Subject: [PATCH] PluginLoadabilityChecker: fixed logic of extension compatibility check if the extension doesn't specify any version, we can't do any constraint other than *. --- src/plugin/PluginLoadabilityChecker.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugin/PluginLoadabilityChecker.php b/src/plugin/PluginLoadabilityChecker.php index a293f33c0..74696749e 100644 --- a/src/plugin/PluginLoadabilityChecker.php +++ b/src/plugin/PluginLoadabilityChecker.php @@ -30,6 +30,7 @@ use pocketmine\utils\Utils; use pocketmine\utils\VersionString; use function array_intersect; use function count; +use function extension_loaded; use function implode; use function in_array; use function phpversion; @@ -77,9 +78,13 @@ final class PluginLoadabilityChecker{ } foreach(Utils::stringifyKeys($description->getRequiredExtensions()) as $extensionName => $versionConstrs){ + if(!extension_loaded($extensionName)){ + return KnownTranslationFactory::pocketmine_plugin_extensionNotLoaded($extensionName); + } $gotVersion = phpversion($extensionName); if($gotVersion === false){ - return KnownTranslationFactory::pocketmine_plugin_extensionNotLoaded($extensionName); + //extensions may set NULL as the extension version, in which case phpversion() may return false + $gotVersion = "**UNKNOWN**"; } foreach($versionConstrs as $k => $constr){ // versionConstrs_loop