Merge branch 'stable' into next-minor

This commit is contained in:
Dylan K. Taylor 2022-03-28 17:18:54 +01:00
commit 7d1464f0a1
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
9 changed files with 66 additions and 69 deletions

View File

@ -57,3 +57,25 @@ Released 18th March 2022.
## Fixes
- Fixed a crash when handling out-of-bounds meta values on the network.
# 4.2.5
Released 28th March 2022.
## General
- The layout of the human-readable part of crashdumps has been changed in an effort to improve the useful information density. It is hoped that this change will cause more useful information to be provided when people paste crash traces on Discord, since all the most important information is now at the top of the file.
- Version, git hash, PHP version and OS have been moved to the top of the crashdump.
- Backtrace has been moved above code sample.
- Docker images are now built by GitHub Actions (first live test).
## Technical
- The methods of `Inventory` and `BaseInventory` have been rearranged to improve coherency.
## Fixes
### API
- Enum members of enums created using `EnumTrait` are now able to have single-character names.
- Registry members of registries created using `RegistryTrait` or `CloningRegistryTrait` now have their names checked for invalid characters.
- `Entity::__construct()` now uses a guard variable to prevent it from being called multiple times unintentionally. This is necessary because `Entity::__construct()` has side effects.
- Fixed `PlayerItemHeldEvent` not being called when the content of the held slot was changed (e.g. replacing the held item via inventory menu).
### Gameplay
- Reduced the appearance of ghost items in unsupported gameplay scenarios using client prediction information. This fixes, for example, the appearance of ghost items when right-clicking on a filled flower pot.

View File

@ -53,8 +53,8 @@
"webmozart/path-util": "^2.3"
},
"require-dev": {
"phpstan/phpstan": "1.4.10",
"phpstan/phpstan-phpunit": "^1.0.0",
"phpstan/phpstan": "1.5.1",
"phpstan/phpstan-phpunit": "^1.1.0",
"phpstan/phpstan-strict-rules": "^1.0.0",
"phpunit/phpunit": "^9.2"
},

35
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": "f3800582ad388d0ec2a95dffc3742d8e",
"content-hash": "fca583271e9a38b30ef924da651f7a20",
"packages": [
{
"name": "adhocore/json-comment",
@ -1906,20 +1906,20 @@
},
{
"name": "phpstan/phpstan",
"version": "1.4.10",
"version": "1.5.1",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "898c479c39caa727bedf4311dd294a8f4e250e72"
"reference": "cc67578d9afd0f5f2545067285613d7a529aefac"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/898c479c39caa727bedf4311dd294a8f4e250e72",
"reference": "898c479c39caa727bedf4311dd294a8f4e250e72",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/cc67578d9afd0f5f2545067285613d7a529aefac",
"reference": "cc67578d9afd0f5f2545067285613d7a529aefac",
"shasum": ""
},
"require": {
"php": "^7.1|^8.0"
"php": "^7.2|^8.0"
},
"conflict": {
"phpstan/phpstan-shim": "*"
@ -1941,7 +1941,7 @@
"description": "PHPStan - PHP Static Analysis Tool",
"support": {
"issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.4.10"
"source": "https://github.com/phpstan/phpstan/tree/1.5.1"
},
"funding": [
{
@ -1961,25 +1961,25 @@
"type": "tidelift"
}
],
"time": "2022-03-14T10:25:45+00:00"
"time": "2022-03-28T15:34:48+00:00"
},
{
"name": "phpstan/phpstan-phpunit",
"version": "1.0.0",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-phpunit.git",
"reference": "9eb88c9f689003a8a2a5ae9e010338ee94dc39b3"
"reference": "09133ce914f1388a8bb8c7f8573aaa3723cff52a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/9eb88c9f689003a8a2a5ae9e010338ee94dc39b3",
"reference": "9eb88c9f689003a8a2a5ae9e010338ee94dc39b3",
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/09133ce914f1388a8bb8c7f8573aaa3723cff52a",
"reference": "09133ce914f1388a8bb8c7f8573aaa3723cff52a",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"phpstan/phpstan": "^1.0"
"php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.5.0"
},
"conflict": {
"phpunit/phpunit": "<7.0"
@ -1992,9 +1992,6 @@
},
"type": "phpstan-extension",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
},
"phpstan": {
"includes": [
"extension.neon",
@ -2014,9 +2011,9 @@
"description": "PHPUnit extensions and rules for PHPStan",
"support": {
"issues": "https://github.com/phpstan/phpstan-phpunit/issues",
"source": "https://github.com/phpstan/phpstan-phpunit/tree/1.0.0"
"source": "https://github.com/phpstan/phpstan-phpunit/tree/1.1.0"
},
"time": "2021-10-14T08:03:54+00:00"
"time": "2022-03-28T09:20:49+00:00"
},
{
"name": "phpstan/phpstan-strict-rules",

View File

@ -44,10 +44,11 @@ final class CrashDumpRenderer{
$this->addLine($this->data->general->name . " Crash Dump " . date("D M j H:i:s T Y", (int) $this->data->time));
$this->addLine();
$this->addLine("Error: " . $this->data->error["message"]);
$this->addLine("File: " . $this->data->error["file"]);
$this->addLine("Line: " . $this->data->error["line"]);
$this->addLine("Type: " . $this->data->error["type"]);
$version = new VersionString($this->data->general->base_version, $this->data->general->is_dev, $this->data->general->build);
$this->addLine($this->data->general->name . " version: " . $version->getFullVersion(true) . " [Protocol " . $this->data->general->protocol . "]");
$this->addLine("Git commit: " . $this->data->general->git);
$this->addLine("PHP version: " . $this->data->general->php);
$this->addLine("OS: " . $this->data->general->php_os . ", " . $this->data->general->os);
if($this->data->plugin_involvement !== CrashDump::PLUGIN_INVOLVEMENT_NONE){
$this->addLine();
@ -62,30 +63,21 @@ final class CrashDumpRenderer{
}
$this->addLine();
$this->addLine("Code:");
foreach($this->data->code as $lineNumber => $line){
$this->addLine("[$lineNumber] $line");
}
$this->addLine();
$this->addLine("Error: " . $this->data->error["message"]);
$this->addLine("File: " . $this->data->error["file"]);
$this->addLine("Line: " . $this->data->error["line"]);
$this->addLine("Type: " . $this->data->error["type"]);
$this->addLine("Backtrace:");
foreach($this->data->trace as $line){
$this->addLine($line);
}
$this->addLine();
$this->addLine("Code:");
$version = new VersionString($this->data->general->base_version, $this->data->general->is_dev, $this->data->general->build);
$this->addLine($this->data->general->name . " version: " . $version->getFullVersion(true) . " [Protocol " . $this->data->general->protocol . "]");
$this->addLine("Git commit: " . $this->data->general->git);
$this->addLine("uname -a: " . $this->data->general->uname);
$this->addLine("PHP Version: " . $this->data->general->php);
$this->addLine("Zend version: " . $this->data->general->zend);
$this->addLine("OS: " . $this->data->general->php_os . ", " . $this->data->general->os);
$this->addLine("Composer libraries: ");
foreach(Utils::stringifyKeys($this->data->general->composer_libraries) as $library => $libraryVersion){
$this->addLine("- $library $libraryVersion");
foreach($this->data->code as $lineNumber => $line){
$this->addLine("[$lineNumber] $line");
}
if(count($this->data->plugins) > 0){
@ -95,6 +87,14 @@ final class CrashDumpRenderer{
$this->addLine($p->name . " " . $p->version . " by " . implode(", ", $p->authors) . " for API(s) " . implode(", ", $p->api));
}
}
$this->addLine();
$this->addLine("uname -a: " . $this->data->general->uname);
$this->addLine("Zend version: " . $this->data->general->zend);
$this->addLine("Composer libraries: ");
foreach(Utils::stringifyKeys($this->data->general->composer_libraries) as $library => $libraryVersion){
$this->addLine("- $library $libraryVersion");
}
}
public function addLine(string $line = "") : void{

View File

@ -335,12 +335,9 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
$this->callDummyItemHeldEvent();
}
},
function(Inventory $unused, array $changedSlots) : void{
function() : void{
$this->setUsingItem(false);
$heldSlot = $this->inventory->getHeldItemIndex();
if(isset($changedSlots[$heldSlot])){
$this->callDummyItemHeldEvent();
}
$this->callDummyItemHeldEvent();
}
));

View File

@ -64,6 +64,9 @@ class ThreadManager extends \Volatile{
*/
public function getAll() : array{
$array = [];
/**
* @var Worker|Thread $thread
*/
foreach($this as $key => $thread){
$array[$key] = $thread;
}

View File

@ -32,7 +32,6 @@ use function curl_getinfo;
use function curl_init;
use function curl_setopt_array;
use function explode;
use function is_int;
use function is_string;
use function preg_match;
use function socket_close;
@ -220,7 +219,6 @@ class Internet{
}
if(!is_string($raw)) throw new AssumptionFailedError("curl_exec() should return string|false when CURLOPT_RETURNTRANSFER is set");
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if(!is_int($httpCode)) throw new AssumptionFailedError("curl_getinfo(CURLINFO_HTTP_CODE) always returns int");
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$rawHeaders = substr($raw, 0, $headerSize);
$body = substr($raw, $headerSize);

View File

@ -905,11 +905,6 @@ parameters:
count: 1
path: ../../../src/scheduler/TaskScheduler.php
-
message: "#^Method pocketmine\\\\thread\\\\ThreadManager\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\thread\\\\Thread\\|pocketmine\\\\thread\\\\Worker\\> but returns array\\.$#"
count: 1
path: ../../../src/thread/ThreadManager.php
-
message: "#^Cannot access offset string on mixed\\.$#"
count: 3
@ -925,16 +920,6 @@ parameters:
count: 1
path: ../../../src/utils/Config.php
-
message: "#^Parameter \\#2 \\$offset of function substr expects int, mixed given\\.$#"
count: 1
path: ../../../src/utils/Internet.php
-
message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, mixed given\\.$#"
count: 1
path: ../../../src/utils/Internet.php
-
message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|false given\\.$#"
count: 1

View File

@ -85,8 +85,3 @@ parameters:
count: 2
path: ../../../src/world/format/io/region/RegionLoader.php
-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNotSame\\(\\) with arguments stdClass, stdClass and 'Cloning registry…' will always evaluate to false\\.$#"
count: 1
path: ../../phpunit/utils/CloningRegistryTraitTest.php