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'); throw new ConnectionFail('Probably connection lost');
} }
$buffer = new ByteBuffer( $buffer = new ByteBuffer();
$socket->read(
// @phpstan-ignore-next-line /** @phpstan-ignore-next-line */
unpack('N', $size)[1] $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)); $this->logger->debug('Received buffer: '.addcslashes($buffer->bytes(), PHP_EOL));