Size must be greater then max output buffer

This commit is contained in:
2021-01-26 17:03:21 +03:00
parent ec2363c064
commit d4d64df087

View File

@@ -190,12 +190,18 @@ abstract class Connection
throw new ConnectionFail('Probably connection lost');
}
$buffer = new ByteBuffer(
$socket->read(
// @phpstan-ignore-next-line
unpack('N', $size)[1]
)
);
$buffer = new ByteBuffer();
/** @phpstan-ignore-next-line */
$size = unpack('N', $size)[1];
do {
$chunk = $socket->read($size);
$buffer->append($chunk);
$size -= \strlen($chunk);
} while (0 < $size);
$this->logger->debug('Received buffer: '.addcslashes($buffer->bytes(), PHP_EOL));