Merge branch 'stable' into next-minor

This commit is contained in:
Dylan K. Taylor 2022-08-25 19:25:19 +01:00
commit c16893cbac
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
17 changed files with 114 additions and 52 deletions

@ -1 +1 @@
Subproject commit f292501a703352ab793b07b7861f3e1b3860ed86
Subproject commit cf79c0172283a0a26f2c3695af260d100e0fdabd

View File

@ -29,3 +29,18 @@ Released 16th August 2022.
- Fixed crash when processing player skins with invalid geometry data.
- Fixed spectator players being able to pick blocks using mousewheel click.
- Improved supporting requirements for sugarcane.
# 4.7.3
Released 22nd August 2022.
## General
- Added complete translations for Spanish and Vietnamese.
- All continuous integration (static analysis, unit tests, integration tests) are now performed on PHP 8.1 as well as 8.0.
- InventoryTransaction now verifies that stack sizes of items after the transaction don't exceed the maximum stack size of the item type or the containing inventory.
## Fixes
- Fixed Normal generator crash on PHP 8.1.
- Fixed a race condition during async worker shutdown that could lead to tasks executing in the wrong order. This (very rarely) led to a crash in `PopulationTask` due to its preceding `GeneratorRegisterTask` not being executed.
- Fixed `/give` accepting negative amounts or amounts larger than 32767 (vanilla max).
- Fixed placement conditions for vines (no longer able to be placed on the side of cacti).
- Fixed incorrect documentation of `SignText::__construct()`.

14
changelogs/4.8.md Normal file
View File

@ -0,0 +1,14 @@
**For Minecraft: Bedrock Edition 1.19.21**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 4.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 4.8.0
Released 9th August 2022.
## General
- Added support for Minecraft: Bedrock Edition 1.19.21.
- Removed support for older versions.

View File

@ -35,7 +35,7 @@
"fgrosse/phpasn1": "^2.3",
"netresearch/jsonmapper": "^4.0",
"pocketmine/bedrock-data": "~1.10.0+bedrock-1.19.20",
"pocketmine/bedrock-protocol": "~12.0.0+bedrock-1.19.20",
"pocketmine/bedrock-protocol": "~12.2.0+bedrock-1.19.20",
"pocketmine/binaryutils": "^0.2.1",
"pocketmine/callback-validator": "^1.0.2",
"pocketmine/classloader": "^0.2.0",

52
composer.lock generated
View File

@ -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": "80afa24adf37096a23643e051d6128ce",
"content-hash": "72bfad1350c97a3df225577163d702ea",
"packages": [
{
"name": "adhocore/json-comment",
@ -271,16 +271,16 @@
},
{
"name": "pocketmine/bedrock-protocol",
"version": "12.0.0+bedrock-1.19.20",
"version": "12.2.0+bedrock-1.19.21",
"source": {
"type": "git",
"url": "https://github.com/pmmp/BedrockProtocol.git",
"reference": "c2778039544fa0c7c5bd3af7963149e7552f4215"
"reference": "d1b3e83f77e2c6628b64793485260cddc55d92e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/c2778039544fa0c7c5bd3af7963149e7552f4215",
"reference": "c2778039544fa0c7c5bd3af7963149e7552f4215",
"url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/d1b3e83f77e2c6628b64793485260cddc55d92e3",
"reference": "d1b3e83f77e2c6628b64793485260cddc55d92e3",
"shasum": ""
},
"require": {
@ -312,9 +312,9 @@
"description": "An implementation of the Minecraft: Bedrock Edition protocol in PHP",
"support": {
"issues": "https://github.com/pmmp/BedrockProtocol/issues",
"source": "https://github.com/pmmp/BedrockProtocol/tree/bedrock-1.19.20"
"source": "https://github.com/pmmp/BedrockProtocol/tree/12.2.0+bedrock-1.19.21"
},
"time": "2022-08-09T17:57:29+00:00"
"time": "2022-08-24T18:47:37+00:00"
},
{
"name": "pocketmine/binaryutils",
@ -532,16 +532,16 @@
},
{
"name": "pocketmine/locale-data",
"version": "2.8.6",
"version": "2.8.7",
"source": {
"type": "git",
"url": "https://github.com/pmmp/Language.git",
"reference": "87f1afaa4824998ece14d71ce37e94bc1f1d3116"
"reference": "e115d3d64a508065f1cedad1be55528906308456"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/Language/zipball/87f1afaa4824998ece14d71ce37e94bc1f1d3116",
"reference": "87f1afaa4824998ece14d71ce37e94bc1f1d3116",
"url": "https://api.github.com/repos/pmmp/Language/zipball/e115d3d64a508065f1cedad1be55528906308456",
"reference": "e115d3d64a508065f1cedad1be55528906308456",
"shasum": ""
},
"type": "library",
@ -549,9 +549,9 @@
"description": "Language resources used by PocketMine-MP",
"support": {
"issues": "https://github.com/pmmp/Language/issues",
"source": "https://github.com/pmmp/Language/tree/2.8.6"
"source": "https://github.com/pmmp/Language/tree/2.8.7"
},
"time": "2022-08-18T15:25:44+00:00"
"time": "2022-08-21T20:37:16+00:00"
},
{
"name": "pocketmine/log",
@ -1891,23 +1891,23 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.15",
"version": "9.2.16",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f"
"reference": "2593003befdcc10db5e213f9f28814f5aa8ac073"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f",
"reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2593003befdcc10db5e213f9f28814f5aa8ac073",
"reference": "2593003befdcc10db5e213f9f28814f5aa8ac073",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"ext-xmlwriter": "*",
"nikic/php-parser": "^4.13.0",
"nikic/php-parser": "^4.14",
"php": ">=7.3",
"phpunit/php-file-iterator": "^3.0.3",
"phpunit/php-text-template": "^2.0.2",
@ -1956,7 +1956,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.16"
},
"funding": [
{
@ -1964,7 +1964,7 @@
"type": "github"
}
],
"time": "2022-03-07T09:28:20+00:00"
"time": "2022-08-20T05:26:47+00:00"
},
{
"name": "phpunit/php-file-iterator",
@ -2209,16 +2209,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.21",
"version": "9.5.22",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1"
"reference": "e329ac6e8744f461518272612a479fde958752fe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0e32b76be457de00e83213528f6bb37e2a38fcb1",
"reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e329ac6e8744f461518272612a479fde958752fe",
"reference": "e329ac6e8744f461518272612a479fde958752fe",
"shasum": ""
},
"require": {
@ -2295,7 +2295,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.21"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.22"
},
"funding": [
{
@ -2307,7 +2307,7 @@
"type": "github"
}
],
"time": "2022-06-19T12:14:25+00:00"
"time": "2022-08-20T08:25:46+00:00"
},
{
"name": "sebastian/cli-parser",

View File

@ -31,7 +31,7 @@ use function str_repeat;
final class VersionInfo{
public const NAME = "PocketMine-MP";
public const BASE_VERSION = "4.7.3";
public const BASE_VERSION = "4.8.1";
public const IS_DEVELOPMENT_BUILD = true;
public const BUILD_CHANNEL = "beta";

View File

@ -116,7 +116,7 @@ class Vine extends Flowable{
}
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if(!$blockClicked->isSolid() || Facing::axis($face) === Axis::Y){
if(!$blockClicked->isFullCube() || Facing::axis($face) === Axis::Y){
return false;
}

View File

@ -39,7 +39,7 @@ class SignText{
private array $lines;
/**
* @param string[]|null $lines index-sensitive; omitting an index will leave it unchanged
* @param string[]|null $lines index-sensitive; keys 0-3 will be used, regardless of array order
*
* @throws \InvalidArgumentException if the array size is greater than 4
* @throws \InvalidArgumentException if invalid keys (out of bounds or string) are found in the array

View File

@ -75,7 +75,11 @@ class GiveCommand extends VanillaCommand{
if(!isset($args[2])){
$item->setCount($item->getMaxStackSize());
}else{
$item->setCount((int) $args[2]);
$count = $this->getBoundedInt($sender, $args[2], 1, 32767);
if($count === null){
return true;
}
$item->setCount($count);
}
if(isset($args[3])){

View File

@ -32,9 +32,7 @@ use pocketmine\utils\TextFormat;
use pocketmine\utils\Utils;
use pocketmine\VersionInfo;
use function count;
use function function_exists;
use function implode;
use function opcache_get_status;
use function sprintf;
use function stripos;
use function strtolower;
@ -71,16 +69,10 @@ class VersionCommand extends VanillaCommand{
));
$sender->sendMessage(KnownTranslationFactory::pocketmine_command_version_phpVersion(PHP_VERSION));
if(
function_exists('opcache_get_status') &&
($opcacheStatus = opcache_get_status(false)) !== false &&
isset($opcacheStatus["jit"]["on"])
){
$jit = $opcacheStatus["jit"];
if($jit["on"] === true){
$jitStatus = KnownTranslationFactory::pocketmine_command_version_phpJitEnabled(
sprintf("CRTO: %s%s%s%s", $jit["opt_flags"] >> 2, $jit["opt_flags"] & 0x03, $jit["kind"], $jit["opt_level"])
);
$jitMode = Utils::getOpcacheJitMode();
if($jitMode !== null){
if($jitMode !== 0){
$jitStatus = KnownTranslationFactory::pocketmine_command_version_phpJitEnabled(sprintf("CRTO: %d", $jitMode));
}else{
$jitStatus = KnownTranslationFactory::pocketmine_command_version_phpJitDisabled();
}

View File

@ -164,6 +164,8 @@ class CrashDump{
}
$this->data->extensions = $extensions;
$this->data->jit_mode = Utils::getOpcacheJitMode();
if($this->server->getConfigGroup()->getPropertyBool("auto-report.send-phpinfo", true)){
ob_start();
phpinfo();

View File

@ -66,6 +66,8 @@ final class CrashDumpData implements \JsonSerializable{
*/
public array $extensions = [];
public ?int $jit_mode = null;
public string $phpinfo = "";
public CrashDumpDataGeneral $general;

View File

@ -42,6 +42,9 @@ class DropItemAction extends InventoryAction{
if($this->targetItem->isNull()){
throw new TransactionValidationException("Cannot drop an empty itemstack");
}
if($this->targetItem->getCount() > $this->targetItem->getMaxStackSize()){
throw new TransactionValidationException("Target item exceeds item type max stack size");
}
}
public function onPreExecute(Player $source) : bool{

View File

@ -70,6 +70,12 @@ class SlotChangeAction extends InventoryAction{
if(!$this->inventory->getItem($this->inventorySlot)->equalsExact($this->sourceItem)){
throw new TransactionValidationException("Slot does not contain expected original item");
}
if($this->targetItem->getCount() > $this->targetItem->getMaxStackSize()){
throw new TransactionValidationException("Target item exceeds item type max stack size");
}
if($this->targetItem->getCount() > $this->inventory->getMaxStackSize()){
throw new TransactionValidationException("Target item exceeds inventory max stack size");
}
}
/**

View File

@ -56,7 +56,9 @@ abstract class Worker extends \Worker{
$this->isKilled = true;
if(!$this->isShutdown()){
while($this->unstack() !== null);
$this->synchronized(function() : void{
while($this->unstack() !== null);
});
$this->notify();
$this->shutdown();
}

View File

@ -69,6 +69,7 @@ use function mb_check_encoding;
use function ob_end_clean;
use function ob_get_contents;
use function ob_start;
use function opcache_get_status;
use function ord;
use function php_uname;
use function phpversion;
@ -486,8 +487,8 @@ final class Utils{
*/
public static function currentTrace(int $skipFrames = 0) : array{
++$skipFrames; //omit this frame from trace, in addition to other skipped frames
if(function_exists("xdebug_get_function_stack")){
$trace = array_reverse(xdebug_get_function_stack());
if(function_exists("xdebug_get_function_stack") && count($trace = @xdebug_get_function_stack()) !== 0){
$trace = array_reverse($trace);
}else{
$e = new \Exception();
$trace = $e->getTrace();
@ -634,4 +635,30 @@ final class Utils{
public static function checkLocationNotInfOrNaN(Location $location) : void{
self::checkVector3NotInfOrNaN($location);
}
/**
* Returns an integer describing the current OPcache JIT setting.
* @see https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit
*/
public static function getOpcacheJitMode() : ?int{
if(
function_exists('opcache_get_status') &&
($opcacheStatus = opcache_get_status(false)) !== false &&
isset($opcacheStatus["jit"]["on"])
){
$jit = $opcacheStatus["jit"];
if($jit["on"] === true){
return (($jit["opt_flags"] >> 2) * 1000) +
(($jit["opt_flags"] & 0x03) * 100) +
($jit["kind"] * 10) +
$jit["opt_level"];
}
//jit available, but disabled
return 0;
}
//jit not available
return null;
}
}

View File

@ -35,11 +35,6 @@ parameters:
count: 1
path: ../../../src/network/mcpe/handler/InGamePacketHandler.php
-
message: "#^Negated boolean expression is always true\\.$#"
count: 1
path: ../../../src/network/mcpe/handler/InGamePacketHandler.php
-
message: "#^Property pocketmine\\\\network\\\\mcpe\\\\raklib\\\\PthreadsChannelWriter\\:\\:\\$buffer is never read, only written\\.$#"
count: 1