From d07acd0013fa3093154de365f9574dd2350f4957 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 17 Apr 2023 14:05:46 +0100 Subject: [PATCH] RakLibInterface: split error ID into 4-character chunks this makes it easier to read, since the error ID can't be copy-pasted from the disconnection screen on the client. --- src/network/mcpe/raklib/RakLibInterface.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/mcpe/raklib/RakLibInterface.php b/src/network/mcpe/raklib/RakLibInterface.php index 46927b4f6..f420d4352 100644 --- a/src/network/mcpe/raklib/RakLibInterface.php +++ b/src/network/mcpe/raklib/RakLibInterface.php @@ -53,6 +53,7 @@ use function implode; use function mt_rand; use function random_bytes; use function rtrim; +use function str_split; use function substr; use const PHP_INT_MAX; @@ -196,7 +197,7 @@ class RakLibInterface implements ServerEventListener, AdvancedNetworkInterface{ try{ $session->handleEncoded($buf); }catch(PacketHandlingException $e){ - $errorId = bin2hex(random_bytes(6)); + $errorId = implode("-", str_split(bin2hex(random_bytes(6)), 4)); $logger = $session->getLogger(); $logger->error("Bad packet (error ID $errorId): " . $e->getMessage());