Skip to content
This repository was archived by the owner on Jul 9, 2026. It is now read-only.

Commit 45fa674

Browse files
committed
Merge branch 'stable' into minor-next
2 parents 9fe216e + 8d52969 commit 45fa674

5 files changed

Lines changed: 29 additions & 30 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"pocketmine/bedrock-block-upgrade-schema": "~5.2.0+bedrock-1.21.110",
3838
"pocketmine/bedrock-data": "~6.5.0+bedrock-1.26.10",
3939
"pocketmine/bedrock-item-upgrade-schema": "~1.16.0+bedrock-1.21.110",
40-
"pocketmine/bedrock-protocol": "~56.0.0+bedrock-1.26.10",
40+
"pocketmine/bedrock-protocol": "~56.1.0+bedrock-1.26.10",
4141
"pocketmine/binaryutils": "^0.2.1",
4242
"pocketmine/callback-validator": "~1.0.4",
4343
"pocketmine/color": "^0.3.0",
@@ -52,7 +52,7 @@
5252
"symfony/filesystem": "~6.4.0"
5353
},
5454
"require-dev": {
55-
"phpstan/phpstan": "2.1.42",
55+
"phpstan/phpstan": "2.1.46",
5656
"phpstan/phpstan-phpunit": "^2.0.0",
5757
"phpstan/phpstan-strict-rules": "^2.0.0",
5858
"phpunit/phpunit": "^10.5.24"

composer.lock

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/network/mcpe/NetworkSession.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ public function handleEncoded(string $payload) : void{
457457
try{
458458
$this->handleDataPacket($packet, $buffer);
459459
}catch(PacketHandlingException $e){
460-
$this->logger->debug($packet->getName() . ": " . base64_encode($buffer));
460+
$this->unhandledPacketDebug($packet, $buffer, "Packet processing error");
461461
throw PacketHandlingException::wrap($e, "Error processing " . $packet->getName());
462462
}catch(FilterNoisyPacketException){
463463
$this->noisyPacketBuffer = $buffer;
@@ -478,7 +478,11 @@ public function handleEncoded(string $payload) : void{
478478
}
479479

480480
private function unhandledPacketDebug(Packet $packet, string $buffer, string $label) : void{
481-
$this->logger->debug($label . ": " . $packet->getName() . ": " . base64_encode($buffer));
481+
$debugSegment = substr($buffer, 0, 1024);
482+
$debugSegmentLength = strlen($debugSegment);
483+
$fullLength = strlen($buffer);
484+
$truncatedLabel = $debugSegmentLength === $fullLength ? "" : " ... (" . ($fullLength - $debugSegmentLength) . " bytes not shown)";
485+
$this->logger->debug($label . ": " . $packet->getName() . " ($fullLength bytes): " . base64_encode($debugSegment) . $truncatedLabel);
482486
}
483487

484488
/**

src/network/mcpe/handler/LoginPacketHandler.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,15 @@ private function defaultJsonMapper(string $logContext) : \JsonMapper{
344344
* @phpstan-return \Closure(object, string, mixed) : void
345345
*/
346346
private function warnUndefinedJsonPropertyHandler(string $context) : \Closure{
347-
return fn(object $object, string $name, mixed $value) => $this->session->getLogger()->warning(
348-
"$context: Unexpected JSON property for " . (new \ReflectionClass($object))->getShortName() . ": " . Utils::printable(substr($name, 0, 80))
349-
);
347+
return function(object $object, string $name, mixed $value) use ($context) : void{
348+
static $count = 0;
349+
if($count++ < 10){
350+
$this->session->getLogger()->warning(
351+
"$context: Unexpected JSON property for " . (new \ReflectionClass($object))->getShortName() . ": " . Utils::printable(substr($name, 0, 80))
352+
);
353+
}else{
354+
throw new PacketHandlingException("$context: Too many unexpected JSON properties");
355+
}
356+
};
350357
}
351358
}

tests/phpstan/configs/phpstan-bugs.neon

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,6 @@ parameters:
6060
count: 1
6161
path: ../../../src/network/mcpe/convert/LegacySkinAdapter.php
6262

63-
-
64-
message: '#^Property pocketmine\\network\\mcpe\\raklib\\PthreadsChannelWriter\:\:\$buffer is never read, only written\.$#'
65-
identifier: property.onlyWritten
66-
count: 1
67-
path: ../../../src/network/mcpe/raklib/PthreadsChannelWriter.php
68-
69-
-
70-
message: '#^Property pocketmine\\network\\mcpe\\raklib\\SnoozeAwarePthreadsChannelWriter\:\:\$buffer is never read, only written\.$#'
71-
identifier: property.onlyWritten
72-
count: 1
73-
path: ../../../src/network/mcpe/raklib/SnoozeAwarePthreadsChannelWriter.php
74-
7563
-
7664
message: '#^Dead catch \- RuntimeException is never thrown in the try block\.$#'
7765
identifier: catch.neverThrown

0 commit comments

Comments
 (0)