diff --git a/src/pocketmine/MemoryManager.php b/src/pocketmine/MemoryManager.php index 91f46d291..e61f9fb77 100644 --- a/src/pocketmine/MemoryManager.php +++ b/src/pocketmine/MemoryManager.php @@ -50,6 +50,7 @@ use function is_object; use function is_resource; use function is_string; use function json_encode; +use function mb_strtoupper; use function min; use function mkdir; use function preg_match; @@ -58,7 +59,6 @@ use function round; use function spl_object_hash; use function sprintf; use function strlen; -use function strtoupper; use function substr; use const JSON_PRETTY_PRINT; use const JSON_UNESCAPED_SLASHES; @@ -127,7 +127,7 @@ class MemoryManager{ if($m <= 0){ $defaultMemory = 0; }else{ - switch(strtoupper($matches[2])){ + switch(mb_strtoupper($matches[2])){ case "K": $defaultMemory = $m / 1024; break; diff --git a/src/pocketmine/entity/Effect.php b/src/pocketmine/entity/Effect.php index 3471a0881..47447a7c9 100644 --- a/src/pocketmine/entity/Effect.php +++ b/src/pocketmine/entity/Effect.php @@ -31,7 +31,7 @@ use pocketmine\event\player\PlayerExhaustEvent; use pocketmine\utils\Color; use function constant; use function defined; -use function strtoupper; +use function mb_strtoupper; class Effect{ public const SPEED = 1; @@ -102,7 +102,7 @@ class Effect{ } public static function getEffectByName(string $name) : ?Effect{ - $const = self::class . "::" . strtoupper($name); + $const = self::class . "::" . mb_strtoupper($name); if(defined($const)){ return self::getEffect(constant($const)); } diff --git a/src/pocketmine/event/EventPriority.php b/src/pocketmine/event/EventPriority.php index a6d65003f..cdc63e8b3 100644 --- a/src/pocketmine/event/EventPriority.php +++ b/src/pocketmine/event/EventPriority.php @@ -25,7 +25,7 @@ namespace pocketmine\event; use function constant; use function defined; -use function strtoupper; +use function mb_strtoupper; /** * List of event priorities @@ -79,7 +79,7 @@ abstract class EventPriority{ * @throws \InvalidArgumentException */ public static function fromString(string $name) : int{ - $name = strtoupper($name); + $name = mb_strtoupper($name); $const = self::class . "::" . $name; if($name !== "ALL" and defined($const)){ return constant($const); diff --git a/src/pocketmine/item/ItemFactory.php b/src/pocketmine/item/ItemFactory.php index 2d537231f..4993b454d 100644 --- a/src/pocketmine/item/ItemFactory.php +++ b/src/pocketmine/item/ItemFactory.php @@ -34,8 +34,8 @@ use function gettype; use function is_numeric; use function is_object; use function is_string; +use function mb_strtoupper; use function str_replace; -use function strtoupper; use function trim; /** @@ -375,8 +375,8 @@ class ItemFactory{ if(is_numeric($b[0])){ $item = self::get((int) $b[0], $meta); - }elseif(defined(ItemIds::class . "::" . strtoupper($b[0]))){ - $item = self::get(constant(ItemIds::class . "::" . strtoupper($b[0])), $meta); + }elseif(defined(ItemIds::class . "::" . mb_strtoupper($b[0]))){ + $item = self::get(constant(ItemIds::class . "::" . mb_strtoupper($b[0])), $meta); }else{ throw new \InvalidArgumentException("Unable to resolve \"" . $str . "\" to a valid item"); } diff --git a/src/pocketmine/item/enchantment/Enchantment.php b/src/pocketmine/item/enchantment/Enchantment.php index 8586cdc3e..4460e595f 100644 --- a/src/pocketmine/item/enchantment/Enchantment.php +++ b/src/pocketmine/item/enchantment/Enchantment.php @@ -26,7 +26,7 @@ namespace pocketmine\item\enchantment; use pocketmine\event\entity\EntityDamageEvent; use function constant; use function defined; -use function strtoupper; +use function mb_strtoupper; /** * Manages enchantment type data. @@ -161,7 +161,7 @@ class Enchantment{ } public static function getEnchantmentByName(string $name) : ?Enchantment{ - $const = Enchantment::class . "::" . strtoupper($name); + $const = Enchantment::class . "::" . mb_strtoupper($name); if(defined($const)){ return self::getEnchantment(constant($const)); } diff --git a/src/pocketmine/plugin/PluginDescription.php b/src/pocketmine/plugin/PluginDescription.php index 10db86877..e4332342e 100644 --- a/src/pocketmine/plugin/PluginDescription.php +++ b/src/pocketmine/plugin/PluginDescription.php @@ -29,12 +29,12 @@ use function array_values; use function constant; use function defined; use function is_array; +use function mb_strtoupper; use function phpversion; use function preg_match; use function str_replace; use function stripos; use function strlen; -use function strtoupper; use function substr; use function version_compare; use function yaml_parse; @@ -147,7 +147,7 @@ class PluginDescription{ $this->prefix = (string) ($plugin["prefix"] ?? $this->prefix); if(isset($plugin["load"])){ - $order = strtoupper($plugin["load"]); + $order = mb_strtoupper($plugin["load"]); if(!defined(PluginLoadOrder::class . "::" . $order)){ throw new PluginException("Invalid PluginDescription load"); }else{ diff --git a/src/pocketmine/plugin/PluginManager.php b/src/pocketmine/plugin/PluginManager.php index 562657f36..e7861c8dc 100644 --- a/src/pocketmine/plugin/PluginManager.php +++ b/src/pocketmine/plugin/PluginManager.php @@ -59,12 +59,12 @@ use function is_dir; use function is_string; use function is_subclass_of; use function iterator_to_array; +use function mb_strtoupper; use function mkdir; use function shuffle; use function stripos; use function strpos; use function strtolower; -use function strtoupper; use const DIRECTORY_SEPARATOR; /** @@ -379,7 +379,7 @@ class PluginManager{ if($version !== $serverString){ $pluginApi = array_pad(explode("-", $version, 2), 2, ""); //0 = version, 1 = suffix (optional) - if(strtoupper($pluginApi[1]) !== strtoupper($serverApi[1])){ //Different release phase (alpha vs. beta) or phase build (alpha.1 vs alpha.2) + if(mb_strtoupper($pluginApi[1]) !== mb_strtoupper($serverApi[1])){ //Different release phase (alpha vs. beta) or phase build (alpha.1 vs alpha.2) continue; }