Merge branch 'stable' into next-minor

This commit is contained in:
Dylan K. Taylor 2022-01-14 00:45:49 +00:00
commit ee6548aa50
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
9 changed files with 60 additions and 36 deletions

View File

@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
image: [ubuntu-20.04]
php: [8.0.11]
php: [8.0.14]
steps:
- name: Build and prepare PHP cache
@ -31,7 +31,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.11]
php: [8.0.14]
steps:
- uses: actions/checkout@v2
@ -69,7 +69,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.11]
php: [8.0.14]
steps:
- uses: actions/checkout@v2
@ -107,7 +107,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.11]
php: [8.0.14]
steps:
- uses: actions/checkout@v2
@ -147,7 +147,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.11]
php: [8.0.14]
steps:
- uses: actions/checkout@v2
@ -201,4 +201,4 @@ jobs:
tools: php-cs-fixer:3.2
- name: Run PHP-CS-Fixer
run: php-cs-fixer fix --dry-run --diff
run: php-cs-fixer fix --dry-run --diff --ansi

View File

@ -36,6 +36,7 @@ return (new PhpCsFixer\Config)
],
'declare_strict_types' => true,
'elseif' => true,
'fully_qualified_strict_types' => true,
'global_namespace_import' => [
'import_constants' => true,
'import_functions' => true,

View File

@ -75,6 +75,14 @@ const ACCEPTED_OPTS = [
"channel" => "Release channel to post this build into"
];
function systemWrapper(string $command, string $errorMessage) : void{
system($command, $result);
if($result !== 0){
echo "error: $errorMessage; aborting\n";
exit(1);
}
}
function main() : void{
$filteredOpts = [];
foreach(Utils::stringifyKeys(getopt("", ["current:", "next:", "channel:", "help"])) as $optName => $optValue){
@ -115,7 +123,7 @@ function main() : void{
echo "$currentVer will be published on release channel \"$channel\".\n";
echo "please add appropriate notes to the changelog and press enter...";
fgets(STDIN);
system('git add "' . dirname(__DIR__) . '/changelogs"');
systemWrapper('git add "' . dirname(__DIR__) . '/changelogs"', "failed to stage changelog changes");
system('git diff --cached --quiet "' . dirname(__DIR__) . '/changelogs"', $result);
if($result === 0){
echo "error: no changelog changes detected; aborting\n";
@ -123,14 +131,15 @@ function main() : void{
}
$versionInfoPath = dirname(__DIR__) . '/src/VersionInfo.php';
replaceVersion($versionInfoPath, $currentVer->getBaseVersion(), false, $channel);
system('git commit -m "Release ' . $currentVer->getBaseVersion() . '" --include "' . $versionInfoPath . '"');
system('git tag ' . $currentVer->getBaseVersion());
systemWrapper('git commit -m "Release ' . $currentVer->getBaseVersion() . '" --include "' . $versionInfoPath . '"', "failed to create release commit");
systemWrapper('git tag ' . $currentVer->getBaseVersion(), "failed to create release tag");
replaceVersion($versionInfoPath, $nextVer->getBaseVersion(), true, $channel);
system('git add "' . $versionInfoPath . '"');
system('git commit -m "' . $nextVer->getBaseVersion() . ' is next" --include "' . $versionInfoPath . '"');
systemWrapper('git add "' . $versionInfoPath . '"', "failed to stage changes for post-release commit");
systemWrapper('git commit -m "' . $nextVer->getBaseVersion() . ' is next" --include "' . $versionInfoPath . '"', "failed to create post-release commit");
echo "pushing changes in 5 seconds\n";
sleep(5);
system('git push origin HEAD ' . $currentVer->getBaseVersion());
systemWrapper('git push origin HEAD ' . $currentVer->getBaseVersion(), "failed to push changes to remote");
}
main();

View File

@ -1600,3 +1600,10 @@ Released 4th January 2022.
- Fixed several denial-of-service attack vectors related to skin data field lengths.
- Fixed food bar desync when cancelling `PlayerItemConsumeEvent` in a plugin.
- Fixed compass needles not updating when the world spawn is changed.
# 4.0.6
Released 13th January 2022.
## Fixes
- Fixed server crash on invalid facing values provided by the client when placing or breaking blocks.
- Fixed documentation link to AsyncTask in Worker.

32
composer.lock generated
View File

@ -322,16 +322,16 @@
},
{
"name": "pocketmine/binaryutils",
"version": "0.2.3",
"version": "0.2.4",
"source": {
"type": "git",
"url": "https://github.com/pmmp/BinaryUtils.git",
"reference": "dc94786fc6c30012b1892f548dbb8a8c9c0a8cd9"
"reference": "5ac7eea91afbad8dc498f5ce34ce6297d5e6ea9a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/BinaryUtils/zipball/dc94786fc6c30012b1892f548dbb8a8c9c0a8cd9",
"reference": "dc94786fc6c30012b1892f548dbb8a8c9c0a8cd9",
"url": "https://api.github.com/repos/pmmp/BinaryUtils/zipball/5ac7eea91afbad8dc498f5ce34ce6297d5e6ea9a",
"reference": "5ac7eea91afbad8dc498f5ce34ce6297d5e6ea9a",
"shasum": ""
},
"require": {
@ -340,7 +340,7 @@
},
"require-dev": {
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "1.2.0",
"phpstan/phpstan": "1.3.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0.0",
"phpunit/phpunit": "^9.5"
@ -358,9 +358,9 @@
"description": "Classes and methods for conveniently handling binary data",
"support": {
"issues": "https://github.com/pmmp/BinaryUtils/issues",
"source": "https://github.com/pmmp/BinaryUtils/tree/0.2.3"
"source": "https://github.com/pmmp/BinaryUtils/tree/0.2.4"
},
"time": "2021-12-04T20:56:05+00:00"
"time": "2022-01-12T18:06:33+00:00"
},
{
"name": "pocketmine/callback-validator",
@ -727,16 +727,16 @@
},
{
"name": "pocketmine/raklib",
"version": "0.14.2",
"version": "0.14.3",
"source": {
"type": "git",
"url": "https://github.com/pmmp/RakLib.git",
"reference": "e3a861187470e1facc6625040128f447ebbcbaec"
"reference": "4798576fec0364266dce23b368a7fec5e5de7927"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/e3a861187470e1facc6625040128f447ebbcbaec",
"reference": "e3a861187470e1facc6625040128f447ebbcbaec",
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/4798576fec0364266dce23b368a7fec5e5de7927",
"reference": "4798576fec0364266dce23b368a7fec5e5de7927",
"shasum": ""
},
"require": {
@ -748,8 +748,8 @@
"pocketmine/log": "^0.3.0 || ^0.4.0"
},
"require-dev": {
"phpstan/phpstan": "0.12.99",
"phpstan/phpstan-strict-rules": "^0.12.2"
"phpstan/phpstan": "1.3.3",
"phpstan/phpstan-strict-rules": "^1.0"
},
"type": "library",
"autoload": {
@ -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.2"
"source": "https://github.com/pmmp/RakLib/tree/0.14.3"
},
"time": "2021-10-04T20:39:11+00:00"
"time": "2022-01-10T21:29:48+00:00"
},
{
"name": "pocketmine/raklib-ipc",
@ -3545,5 +3545,5 @@
"platform-overrides": {
"php": "8.0.0"
},
"plugin-api-version": "2.1.0"
"plugin-api-version": "2.2.0"
}

View File

@ -109,6 +109,7 @@ use function base64_encode;
use function count;
use function fmod;
use function implode;
use function in_array;
use function is_infinite;
use function is_nan;
use function json_decode;
@ -418,6 +419,8 @@ class InGamePacketHandler extends PacketHandler{
}
//TODO: end hack for client spam bug
self::validateFacing($data->getFace());
$blockPos = $data->getBlockPosition();
$vBlockPos = new Vector3($blockPos->getX(), $blockPos->getY(), $blockPos->getZ());
if(!$this->player->interactBlock($vBlockPos, $data->getFace(), $clickPos)){
@ -449,6 +452,15 @@ class InGamePacketHandler extends PacketHandler{
return false;
}
/**
* @throws PacketHandlingException
*/
private static function validateFacing(int $facing) : void{
if(!in_array($facing, Facing::ALL, true)){
throw new PacketHandlingException("Invalid facing value $facing");
}
}
/**
* Internal function used to execute rollbacks when an action fails on a block.
*/
@ -565,6 +577,7 @@ class InGamePacketHandler extends PacketHandler{
switch($action){
case PlayerAction::START_BREAK:
self::validateFacing($face);
if(!$this->player->attackBlock($pos, $face)){
$this->onFailedBlockAction($pos, $face);
}
@ -582,6 +595,7 @@ class InGamePacketHandler extends PacketHandler{
$this->player->stopSleep();
break;
case PlayerAction::CRACK_BREAK:
self::validateFacing($face);
$this->player->continueBreakBlock($pos, $face);
break;
case PlayerAction::INTERACT_BLOCK: //TODO: ignored (for now)

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\thread;
use pocketmine\scheduler\AsyncTask;
use const PTHREADS_INHERIT_NONE;
/**

View File

@ -503,9 +503,6 @@ final class Utils{
*/
public static function parseDocComment(string $docComment) : array{
$rawDocComment = substr($docComment, 3, -2); //remove the opening and closing markers
if($rawDocComment === false){ //usually empty doc comment, but this is safer and statically analysable
return [];
}
preg_match_all('/(*ANYCRLF)^[\t ]*(?:\* )?@([a-zA-Z\-]+)(?:[\t ]+(.+?))?[\t ]*$/m', $rawDocComment, $matches);
return array_combine($matches[1], $matches[2]);

View File

@ -40,11 +40,6 @@ parameters:
count: 1
path: ../../../src/utils/Config.php
-
message: "#^Strict comparison using \\=\\=\\= between string and false will always evaluate to false\\.$#"
count: 1
path: ../../../src/utils/Utils.php
-
message: "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#"
count: 2