diff --git a/src/network/mcpe/auth/ProcessLoginTask.php b/src/network/mcpe/auth/ProcessLoginTask.php index c65203613..c19f67984 100644 --- a/src/network/mcpe/auth/ProcessLoginTask.php +++ b/src/network/mcpe/auth/ProcessLoginTask.php @@ -32,9 +32,9 @@ use pocketmine\network\mcpe\protocol\types\login\JwtChainLinkBody; use pocketmine\network\mcpe\protocol\types\login\JwtHeader; use pocketmine\scheduler\AsyncTask; use function base64_decode; -use function serialize; +use function igbinary_serialize; +use function igbinary_unserialize; use function time; -use function unserialize; class ProcessLoginTask extends AsyncTask{ private const TLS_KEY_ON_COMPLETION = "completion"; @@ -73,7 +73,7 @@ class ProcessLoginTask extends AsyncTask{ */ public function __construct(array $chainJwts, string $clientDataJwt, bool $authRequired, \Closure $onCompletion){ $this->storeLocal(self::TLS_KEY_ON_COMPLETION, $onCompletion); - $this->chain = serialize($chainJwts); + $this->chain = igbinary_serialize($chainJwts); $this->clientDataJwt = $clientDataJwt; $this->authRequired = $authRequired; } @@ -89,7 +89,7 @@ class ProcessLoginTask extends AsyncTask{ private function validateChain() : PublicKeyInterface{ /** @var string[] $chain */ - $chain = unserialize($this->chain); + $chain = igbinary_unserialize($this->chain); $currentKey = null; $first = true; diff --git a/src/scheduler/AsyncTask.php b/src/scheduler/AsyncTask.php index 29ff9a3bd..cd79e6f40 100644 --- a/src/scheduler/AsyncTask.php +++ b/src/scheduler/AsyncTask.php @@ -24,11 +24,11 @@ declare(strict_types=1); namespace pocketmine\scheduler; use pocketmine\utils\AssumptionFailedError; +use function igbinary_serialize; +use function igbinary_unserialize; use function is_scalar; use function is_string; -use function serialize; use function spl_object_id; -use function unserialize; /** * Class used to run async tasks in other threads. @@ -109,7 +109,7 @@ abstract class AsyncTask extends \Threaded{ public function getResult(){ if($this->serialized){ if(!is_string($this->result)) throw new AssumptionFailedError("Result expected to be a serialized string"); - return unserialize($this->result); + return igbinary_unserialize($this->result); } return $this->result; } @@ -130,7 +130,7 @@ abstract class AsyncTask extends \Threaded{ * @param mixed $result */ public function setResult($result) : void{ - $this->result = ($this->serialized = !is_scalar($result)) ? serialize($result) : $result; + $this->result = ($this->serialized = !is_scalar($result)) ? igbinary_serialize($result) : $result; } public function setSubmitted() : void{ @@ -161,7 +161,7 @@ abstract class AsyncTask extends \Threaded{ * @param mixed $progress A value that can be safely serialize()'ed. */ public function publishProgress($progress) : void{ - $this->progressUpdates[] = serialize($progress); + $this->progressUpdates[] = igbinary_serialize($progress); } /** @@ -170,7 +170,7 @@ abstract class AsyncTask extends \Threaded{ public function checkProgressUpdates() : void{ while($this->progressUpdates->count() !== 0){ $progress = $this->progressUpdates->shift(); - $this->onProgressUpdate(unserialize($progress)); + $this->onProgressUpdate(igbinary_unserialize($progress)); } } diff --git a/src/scheduler/BulkCurlTask.php b/src/scheduler/BulkCurlTask.php index 5dd534ebd..bd9a3b059 100644 --- a/src/scheduler/BulkCurlTask.php +++ b/src/scheduler/BulkCurlTask.php @@ -25,8 +25,8 @@ namespace pocketmine\scheduler; use pocketmine\utils\Internet; use pocketmine\utils\InternetException; -use function serialize; -use function unserialize; +use function igbinary_serialize; +use function igbinary_unserialize; /** * Executes a consecutive list of cURL operations. @@ -48,12 +48,12 @@ class BulkCurlTask extends AsyncTask{ * @phpstan-param list, extraOpts?: array}> $operations */ public function __construct(array $operations){ - $this->operations = serialize($operations); + $this->operations = igbinary_serialize($operations); } public function onRun() : void{ /** @phpstan-var list, extraOpts?: array}> $operations */ - $operations = unserialize($this->operations); + $operations = igbinary_unserialize($this->operations); $results = []; foreach($operations as $op){ try{ diff --git a/src/world/generator/GeneratorRegisterTask.php b/src/world/generator/GeneratorRegisterTask.php index d00235120..25f4777d6 100644 --- a/src/world/generator/GeneratorRegisterTask.php +++ b/src/world/generator/GeneratorRegisterTask.php @@ -26,8 +26,8 @@ namespace pocketmine\world\generator; use pocketmine\scheduler\AsyncTask; use pocketmine\world\biome\Biome; use pocketmine\world\World; -use function serialize; -use function unserialize; +use function igbinary_serialize; +use function igbinary_unserialize; class GeneratorRegisterTask extends AsyncTask{ @@ -48,7 +48,7 @@ class GeneratorRegisterTask extends AsyncTask{ */ public function __construct(World $world, string $generatorClass, array $generatorSettings = []){ $this->generatorClass = $generatorClass; - $this->settings = serialize($generatorSettings); + $this->settings = igbinary_serialize($generatorSettings); $this->seed = $world->getSeed(); $this->worldId = $world->getId(); $this->worldHeight = $world->getWorldHeight(); @@ -63,7 +63,7 @@ class GeneratorRegisterTask extends AsyncTask{ * @var Generator $generator * @see Generator::__construct() */ - $generator = new $this->generatorClass($manager, $this->seed, unserialize($this->settings)); + $generator = new $this->generatorClass($manager, $this->seed, igbinary_unserialize($this->settings)); $this->worker->saveToThreadStore("generation.world{$this->worldId}.generator", $generator); } }