From 232393b82e4d6f73c3b10b5dcf3ff566ad5e662d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Ram=C3=B3n=20D=C3=ADaz=20Ramos?= Date: Sat, 23 May 2015 20:06:48 +0200 Subject: [PATCH] Fix for read function not reading the correct number of bytes --- src/Engine/AbstractSocketIO.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Engine/AbstractSocketIO.php b/src/Engine/AbstractSocketIO.php index b30745d..e647e0c 100644 --- a/src/Engine/AbstractSocketIO.php +++ b/src/Engine/AbstractSocketIO.php @@ -99,8 +99,8 @@ public function read() // the second byte contains the mask bit and the payload's length $data .= $part = fread($this->stream, 1); - $length = (int) (bin2hex($part) & ~0x80); // removing the mask bit - $mask = (bool) (bin2hex($part) & 0x80); + $length = hexdec(bin2hex($part) & ~0x80); // removing the mask bit + $mask = (bool)(bin2hex($part) & 0x80); /* * Here is where it is getting tricky :