From fd0fcecb460720538830c179de3c38019a7dc9c9 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sun, 23 Mar 2014 01:55:26 +0100 Subject: [PATCH] Oops, seems like Utils::readInt() is reading an unsigned long because of PHP silliness --- src/PocketMine/utils/Utils.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/PocketMine/utils/Utils.php b/src/PocketMine/utils/Utils.php index 93463d2c2..2226586de 100644 --- a/src/PocketMine/utils/Utils.php +++ b/src/PocketMine/utils/Utils.php @@ -705,6 +705,9 @@ class Utils{ public static function readInt($str){ list(, $unpacked) = @unpack("N", $str); + if($unpacked > 2147483647){ + $unpacked -= 4294967296; + } return (int) $unpacked; } @@ -714,6 +717,9 @@ class Utils{ public static function readLInt($str){ list(, $unpacked) = @unpack("V", $str); + if($unpacked >= 2147483648){ + $unpacked -= 4294967296; + } return (int) $unpacked; }