From 47cf58be8a41f851c80fc956f85a7ab06e609744 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 27 Jan 2021 20:11:37 +0000 Subject: [PATCH 1/8] phpstan 0.12.70 --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 2ecefd869..256739ac5 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "composer-runtime-api": "^2.0" }, "require-dev": { - "phpstan/phpstan": "0.12.69", + "phpstan/phpstan": "0.12.70", "phpstan/phpstan-phpunit": "^0.12.6", "phpstan/phpstan-strict-rules": "^0.12.2", "phpunit/phpunit": "^9.2" diff --git a/composer.lock b/composer.lock index 2b644913d..5d89dbdc6 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": "5466cbf8934081309e4c8ad5c2781f65", + "content-hash": "9eeb09b962ba8c3d870ae4ab2c63c413", "packages": [ { "name": "adhocore/json-comment", @@ -1002,16 +1002,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.69", + "version": "0.12.70", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "8f436ea35241da33487fd0d38b4bc3e6dfe30ea8" + "reference": "07f0ef37f5f876e8cee44cc8ea0ec3fe80d499ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8f436ea35241da33487fd0d38b4bc3e6dfe30ea8", - "reference": "8f436ea35241da33487fd0d38b4bc3e6dfe30ea8", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/07f0ef37f5f876e8cee44cc8ea0ec3fe80d499ee", + "reference": "07f0ef37f5f876e8cee44cc8ea0ec3fe80d499ee", "shasum": "" }, "require": { @@ -1042,7 +1042,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.69" + "source": "https://github.com/phpstan/phpstan/tree/0.12.70" }, "funding": [ { @@ -1058,7 +1058,7 @@ "type": "tidelift" } ], - "time": "2021-01-24T14:55:37+00:00" + "time": "2021-01-27T17:06:47+00:00" }, { "name": "phpstan/phpstan-phpunit", From cda472333cd2a14344f94deb6d9726bc0c7c0751 Mon Sep 17 00:00:00 2001 From: Dylan T Date: Wed, 27 Jan 2021 22:47:33 +0000 Subject: [PATCH 2/8] Add workflow for dessant/support-requests we're using the legacy github app right now. --- .github/workflows/support.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/support.yml diff --git a/.github/workflows/support.yml b/.github/workflows/support.yml new file mode 100644 index 000000000..07984f128 --- /dev/null +++ b/.github/workflows/support.yml @@ -0,0 +1,22 @@ +name: 'Manage support request issues' + +on: + issues: + types: [labeled, unlabeled, reopened] + +jobs: + support: + runs-on: ubuntu-latest + steps: + - uses: dessant/support-requests@v2 + with: + github-token: ${{ github.token }} + support-label: "Support request" + issue-comment: > + Thanks, but this issue tracker is not intended for support requests. Please read the guidelines on [submitting an issue](https://github.com/pmmp/PocketMine-MP/blob/master/CONTRIBUTING.md#creating-an-issue). + + + [Docs](https://pmmp.rtfd.io) | [Discord](https://discord.gg/bmSAZBG) | [Forums](https://forums.pmmp.io) + + close-issue: true + lock-issue: false From 02ee0f23c040780a4449ea8a75d56fc0a6a66ac2 Mon Sep 17 00:00:00 2001 From: Dylan T Date: Wed, 27 Jan 2021 22:53:37 +0000 Subject: [PATCH 3/8] Removed old support requests configuration --- .github/support.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 .github/support.yml diff --git a/.github/support.yml b/.github/support.yml deleted file mode 100644 index fe3493dfb..000000000 --- a/.github/support.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Configuration for support-requests - https://github.com/dessant/support-requests - -# Label used to mark issues as support requests -supportLabel: "Support request" -# Comment to post on issues marked as support requests. Add a link -# to a support page, or set to `false` to disable -supportComment: > - Thanks, but this issue tracker is not intended for support requests. Please read the guidelines on [submitting an issue](https://github.com/pmmp/PocketMine-MP/blob/master/CONTRIBUTING.md#creating-an-issue). - - - [Docs](https://pmmp.rtfd.io) | [Discord](https://discord.gg/bmSAZBG) | [Forums](https://forums.pmmp.io) - -# Whether to close issues marked as support requests -close: true -# Whether to lock issues marked as support requests -lock: false From 37e8dd6444cea8d3ca38331e55b96f5d2406abfa Mon Sep 17 00:00:00 2001 From: yuko fuyutsuki Date: Sun, 31 Jan 2021 21:08:47 +0900 Subject: [PATCH 4/8] Fix PHP 8 optional before required parameters deprecation warnings (#4016) --- src/pocketmine/event/block/BlockBreakEvent.php | 2 +- src/pocketmine/network/rcon/RCONInstance.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/event/block/BlockBreakEvent.php b/src/pocketmine/event/block/BlockBreakEvent.php index 63a6783f8..df821ee85 100644 --- a/src/pocketmine/event/block/BlockBreakEvent.php +++ b/src/pocketmine/event/block/BlockBreakEvent.php @@ -48,7 +48,7 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{ /** * @param Item[] $drops */ - public function __construct(Player $player, Block $block, Item $item, bool $instaBreak = false, array $drops, int $xpDrops = 0){ + public function __construct(Player $player, Block $block, Item $item, bool $instaBreak = false, array $drops = [], int $xpDrops = 0){ parent::__construct($block); $this->item = $item; $this->player = $player; diff --git a/src/pocketmine/network/rcon/RCONInstance.php b/src/pocketmine/network/rcon/RCONInstance.php index 05aa0a5ac..2ff3e07da 100644 --- a/src/pocketmine/network/rcon/RCONInstance.php +++ b/src/pocketmine/network/rcon/RCONInstance.php @@ -77,7 +77,7 @@ class RCONInstance extends Thread{ * @param resource $socket * @param resource $ipcSocket */ - public function __construct($socket, string $password, int $maxClients = 50, \ThreadedLogger $logger, $ipcSocket, ?SleeperNotifier $notifier){ + public function __construct($socket, string $password, int $maxClients, \ThreadedLogger $logger, $ipcSocket, ?SleeperNotifier $notifier){ $this->stop = false; $this->cmd = ""; $this->response = ""; From bef906b0f0e9627f332079874c98ded5194fead7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 2 Feb 2021 00:05:32 +0000 Subject: [PATCH 5/8] phpstan 0.12.71 --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 256739ac5..d9eef0684 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "composer-runtime-api": "^2.0" }, "require-dev": { - "phpstan/phpstan": "0.12.70", + "phpstan/phpstan": "0.12.71", "phpstan/phpstan-phpunit": "^0.12.6", "phpstan/phpstan-strict-rules": "^0.12.2", "phpunit/phpunit": "^9.2" diff --git a/composer.lock b/composer.lock index 5d89dbdc6..6f26a0f75 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": "9eeb09b962ba8c3d870ae4ab2c63c413", + "content-hash": "e6d407c8e77d6a9305bbeff8c8e2c560", "packages": [ { "name": "adhocore/json-comment", @@ -1002,16 +1002,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.70", + "version": "0.12.71", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "07f0ef37f5f876e8cee44cc8ea0ec3fe80d499ee" + "reference": "d508fa3b0ecc5fc91ac70c6c7ac2862f968ba2b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/07f0ef37f5f876e8cee44cc8ea0ec3fe80d499ee", - "reference": "07f0ef37f5f876e8cee44cc8ea0ec3fe80d499ee", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d508fa3b0ecc5fc91ac70c6c7ac2862f968ba2b5", + "reference": "d508fa3b0ecc5fc91ac70c6c7ac2862f968ba2b5", "shasum": "" }, "require": { @@ -1042,7 +1042,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.70" + "source": "https://github.com/phpstan/phpstan/tree/0.12.71" }, "funding": [ { @@ -1058,7 +1058,7 @@ "type": "tidelift" } ], - "time": "2021-01-27T17:06:47+00:00" + "time": "2021-02-01T18:24:00+00:00" }, { "name": "phpstan/phpstan-phpunit", From 1a24afc6d1b3f2982dca3c654e88351c2d8ab56e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 2 Feb 2021 00:13:58 +0000 Subject: [PATCH 6/8] InventoryTransaction: Fixed indexes persisting from balance calculation in crafting input/outputs fixes #4019 the order of the actual items may not be the same across runs, but index 0 will at least be sure to exist. --- src/pocketmine/inventory/transaction/InventoryTransaction.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pocketmine/inventory/transaction/InventoryTransaction.php b/src/pocketmine/inventory/transaction/InventoryTransaction.php index 053a15712..6d005651a 100644 --- a/src/pocketmine/inventory/transaction/InventoryTransaction.php +++ b/src/pocketmine/inventory/transaction/InventoryTransaction.php @@ -30,6 +30,7 @@ use pocketmine\inventory\transaction\action\SlotChangeAction; use pocketmine\item\Item; use pocketmine\Player; use function array_keys; +use function array_values; use function assert; use function count; use function get_class; @@ -168,6 +169,8 @@ class InventoryTransaction{ } } } + $needItems = array_values($needItems); + $haveItems = array_values($haveItems); } /** From fe731b90189bffdfe5a5de5e3af667427663308b Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 2 Feb 2021 13:43:12 +0000 Subject: [PATCH 7/8] Added failing test case for region header validation fucking PHP... what genius thought it was a good idea to cache file stats without even an attempt at keeping the cache up to date on modifications? --- .../level/format/io/region/RegionLoaderTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/phpunit/level/format/io/region/RegionLoaderTest.php b/tests/phpunit/level/format/io/region/RegionLoaderTest.php index 0640f1858..a99ffcb21 100644 --- a/tests/phpunit/level/format/io/region/RegionLoaderTest.php +++ b/tests/phpunit/level/format/io/region/RegionLoaderTest.php @@ -115,4 +115,19 @@ class RegionLoaderTest extends TestCase{ $this->expectException(\InvalidArgumentException::class); $this->region->readChunk($x, $z); } + + /** + * Test that cached filesize() values don't break validation of region headers + */ + public function testRegionHeaderCachedFilesizeRegression() : void{ + $this->region->close(); + $region = new RegionLoader($this->regionPath, 0, 0); //now we have a region, so the header will be verified, triggering two filesize() calls + $region->open(); + $data = str_repeat("hello", 2000); + $region->writeChunk(0, 0, $data); //add some data to the end of the file, to make the cached filesize invalid + $region->close(); + $region = new RegionLoader($this->regionPath, 0, 0); + $region->open(); + self::assertSame($data, $region->readChunk(0, 0)); + } } From bd303b10629973e4e4485ecb25c1f4117121efae Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 2 Feb 2021 13:43:52 +0000 Subject: [PATCH 8/8] RegionLoader: fixed flaky region header validation since 3.17.3 --- src/pocketmine/level/format/io/region/RegionLoader.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pocketmine/level/format/io/region/RegionLoader.php b/src/pocketmine/level/format/io/region/RegionLoader.php index 05cfe40b3..0d17ae3b8 100644 --- a/src/pocketmine/level/format/io/region/RegionLoader.php +++ b/src/pocketmine/level/format/io/region/RegionLoader.php @@ -32,6 +32,7 @@ use pocketmine\utils\BinaryStream; use function assert; use function ceil; use function chr; +use function clearstatcache; use function fclose; use function feof; use function file_exists; @@ -100,6 +101,7 @@ class RegionLoader{ * @throws CorruptedRegionException */ public function open(){ + clearstatcache(false, $this->filePath); $exists = file_exists($this->filePath); if(!$exists){ touch($this->filePath); @@ -409,6 +411,7 @@ class RegionLoader{ fwrite($this->filePointer, Binary::writeInt($entry !== null ? ($entry->getFirstSector() << 8) | $entry->getSectorCount() : 0), 4); fseek($this->filePointer, 4096 + ($index << 2)); fwrite($this->filePointer, Binary::writeInt($entry !== null ? $entry->getTimestamp() : 0), 4); + clearstatcache(false, $this->filePath); } /**