mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 18:59:00 +00:00
Oops, seems like Utils::readInt() is reading an unsigned long because of PHP silliness
This commit is contained in:
parent
d18952a06e
commit
fd0fcecb46
@ -705,6 +705,9 @@ class Utils{
|
|||||||
|
|
||||||
public static function readInt($str){
|
public static function readInt($str){
|
||||||
list(, $unpacked) = @unpack("N", $str);
|
list(, $unpacked) = @unpack("N", $str);
|
||||||
|
if($unpacked > 2147483647){
|
||||||
|
$unpacked -= 4294967296;
|
||||||
|
}
|
||||||
return (int) $unpacked;
|
return (int) $unpacked;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -714,6 +717,9 @@ class Utils{
|
|||||||
|
|
||||||
public static function readLInt($str){
|
public static function readLInt($str){
|
||||||
list(, $unpacked) = @unpack("V", $str);
|
list(, $unpacked) = @unpack("V", $str);
|
||||||
|
if($unpacked >= 2147483648){
|
||||||
|
$unpacked -= 4294967296;
|
||||||
|
}
|
||||||
return (int) $unpacked;
|
return (int) $unpacked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user