mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 11:58:00 +00:00
protocol: avoid potential constructor refactoring packet decode bug
if the order of the constructor parameters were changed, it would cause these statements to be reordered, causing packet fields to be decoded in the wrong order.
This commit is contained in:
@@ -91,14 +91,13 @@ class ResourcePackInfoEntry{
|
||||
}
|
||||
|
||||
public static function read(PacketSerializer $in) : self{
|
||||
return new self(
|
||||
$uuid = $in->getString(),
|
||||
$version = $in->getString(),
|
||||
$sizeBytes = $in->getLLong(),
|
||||
$encryptionKey = $in->getString(),
|
||||
$subPackName = $in->getString(),
|
||||
$contentId = $in->getString(),
|
||||
$hasScripts = $in->getBool()
|
||||
);
|
||||
$uuid = $in->getString();
|
||||
$version = $in->getString();
|
||||
$sizeBytes = $in->getLLong();
|
||||
$encryptionKey = $in->getString();
|
||||
$subPackName = $in->getString();
|
||||
$contentId = $in->getString();
|
||||
$hasScripts = $in->getBool();
|
||||
return new self($uuid, $version, $sizeBytes, $encryptionKey, $subPackName, $contentId, $hasScripts);
|
||||
}
|
||||
}
|
||||
|
@@ -59,10 +59,9 @@ class ResourcePackStackEntry{
|
||||
}
|
||||
|
||||
public static function read(PacketSerializer $in) : self{
|
||||
return new self(
|
||||
$packId = $in->getString(),
|
||||
$version = $in->getString(),
|
||||
$subPackName = $in->getString()
|
||||
);
|
||||
$packId = $in->getString();
|
||||
$version = $in->getString();
|
||||
$subPackName = $in->getString();
|
||||
return new self($packId, $version, $subPackName);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user