diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 71566601e..896887b49 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: image: [ubuntu-20.04] - php: [8.0.16] + php: [8.0.18] steps: - name: Build and prepare PHP cache @@ -31,7 +31,7 @@ jobs: fail-fast: false matrix: image: [ubuntu-20.04] - php: [8.0.16] + php: [8.0.18] steps: - uses: actions/checkout@v2 @@ -69,7 +69,7 @@ jobs: fail-fast: false matrix: image: [ubuntu-20.04] - php: [8.0.16] + php: [8.0.18] steps: - uses: actions/checkout@v2 @@ -107,7 +107,7 @@ jobs: fail-fast: false matrix: image: [ubuntu-20.04] - php: [8.0.16] + php: [8.0.18] steps: - uses: actions/checkout@v2 @@ -147,7 +147,7 @@ jobs: fail-fast: false matrix: image: [ubuntu-20.04] - php: [8.0.16] + php: [8.0.18] steps: - uses: actions/checkout@v2 diff --git a/changelogs/4.2.md b/changelogs/4.2.md index 6451bfe88..96f849148 100644 --- a/changelogs/4.2.md +++ b/changelogs/4.2.md @@ -85,3 +85,25 @@ Released 1st April 2022. ## Fixes - Fixed buffer length underflow crash in `LoginPacket` handling. + +# 4.2.7 +Released 15th April 2022. + +## General +- Added lots more documentation (in comments) about the `aliases` section in `pocketmine.yml`. You can read about this feature in the `aliases` section of the [updated `pocketmine.yml` template](/resources/pocketmine.yml). +- Improved wording of documentation of `PlayerPreLoginEvent`. + +## Fixes +- Fixed core server crash when a plugin causes another plugin to be disabled during a scheduled task. +- Fixed core server crash when loading a plugin with an abstract main class. +- Fixed ghost items in many interaction situations (most notably, using projectiles while looking at an entity or block). +- Implemented a workaround for a client teleport bug which led to player positions not updating properly when using ender pearls. +- Fixed buggy movement when teleporting the player during `PlayerToggleSneakEvent`, `PlayerToggleSprintEvent`, `PlayerToggleSwimEvent` and `PlayerToggleGlideEvent`. + +# 4.2.8 +Released 17th April 2022. + +## Fixes +- Fixed a memory leak in RakLib which could result in a server crash when players stay online for a long time. +- Fixed server crash when attempting to load a corrupted empty resource pack. +- Fixed users with the same name with differerently cased letters being able to duplicate items (userdata is matched by case-insensitive name). diff --git a/composer.json b/composer.json index 780f4f7d4..7beb344cb 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,7 @@ "webmozart/path-util": "^2.3" }, "require-dev": { - "phpstan/phpstan": "1.5.4", + "phpstan/phpstan": "1.5.6", "phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-strict-rules": "^1.0.0", "phpunit/phpunit": "^9.2" diff --git a/composer.lock b/composer.lock index 815d44ed8..35a3bafb2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7e7da4bafdfc9f2b9bfbb3dc7cda739c", + "content-hash": "312b0119034654b3c161ef945b29488e", "packages": [ { "name": "adhocore/json-comment", @@ -727,16 +727,16 @@ }, { "name": "pocketmine/raklib", - "version": "0.14.3", + "version": "0.14.4", "source": { "type": "git", "url": "https://github.com/pmmp/RakLib.git", - "reference": "4798576fec0364266dce23b368a7fec5e5de7927" + "reference": "1ea8e3b95a1b6bf785dc27d76578657be4185f42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/RakLib/zipball/4798576fec0364266dce23b368a7fec5e5de7927", - "reference": "4798576fec0364266dce23b368a7fec5e5de7927", + "url": "https://api.github.com/repos/pmmp/RakLib/zipball/1ea8e3b95a1b6bf785dc27d76578657be4185f42", + "reference": "1ea8e3b95a1b6bf785dc27d76578657be4185f42", "shasum": "" }, "require": { @@ -748,7 +748,7 @@ "pocketmine/log": "^0.3.0 || ^0.4.0" }, "require-dev": { - "phpstan/phpstan": "1.3.3", + "phpstan/phpstan": "1.5.4", "phpstan/phpstan-strict-rules": "^1.0" }, "type": "library", @@ -764,9 +764,9 @@ "description": "A RakNet server implementation written in PHP", "support": { "issues": "https://github.com/pmmp/RakLib/issues", - "source": "https://github.com/pmmp/RakLib/tree/0.14.3" + "source": "https://github.com/pmmp/RakLib/tree/0.14.4" }, - "time": "2022-01-10T21:29:48+00:00" + "time": "2022-04-17T18:42:17+00:00" }, { "name": "pocketmine/raklib-ipc", @@ -1819,16 +1819,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.5.4", + "version": "1.5.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "bbf68cae24f6dc023c607ea0f87da55dd9d55c2b" + "reference": "799dd8c2d2c9c704bb55d2078078cb970cf0f6d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/bbf68cae24f6dc023c607ea0f87da55dd9d55c2b", - "reference": "bbf68cae24f6dc023c607ea0f87da55dd9d55c2b", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/799dd8c2d2c9c704bb55d2078078cb970cf0f6d1", + "reference": "799dd8c2d2c9c704bb55d2078078cb970cf0f6d1", "shasum": "" }, "require": { @@ -1854,7 +1854,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.5.4" + "source": "https://github.com/phpstan/phpstan/tree/1.5.6" }, "funding": [ { @@ -1874,7 +1874,7 @@ "type": "tidelift" } ], - "time": "2022-04-03T12:39:00+00:00" + "time": "2022-04-15T11:13:37+00:00" }, { "name": "phpstan/phpstan-phpunit", @@ -2766,16 +2766,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.3", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", "shasum": "" }, "require": { @@ -2817,7 +2817,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" }, "funding": [ { @@ -2825,7 +2825,7 @@ "type": "github" } ], - "time": "2020-09-28T05:52:38+00:00" + "time": "2022-04-03T09:37:03+00:00" }, { "name": "sebastian/exporter", diff --git a/src/Server.php b/src/Server.php index fff4d99c7..7c4202f9e 100644 --- a/src/Server.php +++ b/src/Server.php @@ -132,6 +132,7 @@ use function get_class; use function ini_set; use function is_array; use function is_dir; +use function is_object; use function is_resource; use function is_string; use function json_decode; @@ -1617,7 +1618,7 @@ class Server{ "reportPaste" => base64_encode($dump->getEncodedData()) ], 10, [], $postUrlError); - if($reply !== null && ($data = json_decode($reply->getBody())) !== null){ + if($reply !== null && is_object($data = json_decode($reply->getBody()))){ if(isset($data->crashId) && isset($data->crashUrl)){ $reportId = $data->crashId; $reportUrl = $data->crashUrl; diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index f1faeb395..5ae77bff7 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -125,6 +125,7 @@ use function get_class; use function in_array; use function json_encode; use function ksort; +use function strcasecmp; use function strlen; use function strtolower; use function substr; @@ -635,7 +636,7 @@ class NetworkSession{ continue; } $info = $existingSession->getPlayerInfo(); - if($info !== null && ($info->getUsername() === $this->info->getUsername() || $info->getUuid()->equals($this->info->getUuid()))){ + if($info !== null && (strcasecmp($info->getUsername(), $this->info->getUsername()) === 0 || $info->getUuid()->equals($this->info->getUuid()))){ if($kickForXUIDMismatch($info instanceof XboxLivePlayerInfo ? $info->getXuid() : "")){ return; } diff --git a/src/resourcepacks/ZippedResourcePack.php b/src/resourcepacks/ZippedResourcePack.php index d67a205fc..2ec39445b 100644 --- a/src/resourcepacks/ZippedResourcePack.php +++ b/src/resourcepacks/ZippedResourcePack.php @@ -64,6 +64,13 @@ class ZippedResourcePack implements ResourcePack{ if(!file_exists($zipPath)){ throw new ResourcePackException("File not found"); } + $size = filesize($zipPath); + if($size === false){ + throw new ResourcePackException("Unable to determine size of file"); + } + if($size === 0){ + throw new ResourcePackException("Empty file, probably corrupted"); + } $archive = new \ZipArchive(); if(($openResult = $archive->open($zipPath)) !== true){