From 3e2cfd28ccf370ade351c3858482b06f0291502f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 17 Jul 2020 23:07:37 +0100 Subject: [PATCH] ResourcePackManager: change validity check to is_string() --- src/resourcepacks/ResourcePackManager.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/resourcepacks/ResourcePackManager.php b/src/resourcepacks/ResourcePackManager.php index bbe83ca3c..1b6af4549 100644 --- a/src/resourcepacks/ResourcePackManager.php +++ b/src/resourcepacks/ResourcePackManager.php @@ -31,6 +31,7 @@ use function file_exists; use function gettype; use function is_array; use function is_dir; +use function is_string; use function mkdir; use function strtolower; use const DIRECTORY_SEPARATOR; @@ -78,14 +79,11 @@ class ResourcePackManager{ } foreach($resourceStack as $pos => $pack){ - try{ - $pack = (string) $pack; - }catch(\ErrorException $e){ + if(!is_string($pack)){ $logger->critical("Found invalid entry in resource pack list at offset $pos of type " . gettype($pack)); continue; } try{ - /** @var string $pack */ $packPath = $this->path . DIRECTORY_SEPARATOR . $pack; if(!file_exists($packPath)){ throw new ResourcePackException("File or directory not found");