Merge pull request #66 from Domochip/master

Fix PR65 Undefined variable
This commit is contained in:
Chris Boden 2022-08-18 07:58:48 -04:00 committed by GitHub
commit 82760a7616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -150,6 +150,7 @@ class MessageBuffer {
$payload_length = unpack('C', $data[$frameStart + 1] & "\x7f")[1];
$isMasked = ($data[$frameStart + 1] & "\x80") === "\x80";
$headerSize += $isMasked ? 4 : 0;
$payloadLenOver2GB = false;
if ($payload_length > 125 && ($dataLen - $frameStart < $headerSize + 125)) {
// no point of checking - this frame is going to be bigger than the buffer is right now
break;
@ -158,7 +159,6 @@ class MessageBuffer {
$payloadLenBytes = $payload_length === 126 ? 2 : 8;
$headerSize += $payloadLenBytes;
$bytesToUpack = substr($data, $frameStart + 2, $payloadLenBytes);
$payloadLenOver2GB = false;
if ($payload_length === 126){
$payload_length = unpack('n', $bytesToUpack)[1];