Fix PR65 Undefined variable

This commit is contained in:
DomoChip 2022-08-18 08:01:15 +02:00
parent 382a3ed941
commit fe3db0a5d8

View File

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