Skip to content

Commit 8bd9a8b

Browse files
committed
only break loop if an actual message has been received
1 parent 7afa7d7 commit 8bd9a8b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/protocol/AProtocol.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected function read(?int &$signature)
7171
$msg = '';
7272
while (true) {
7373
$header = $this->connection->read(2);
74-
if (ord($header[0]) == 0x00 && ord($header[1]) == 0x00)
74+
if ($msg !== '' && ord($header[0]) == 0x00 && ord($header[1]) == 0x00)
7575
break;
7676
$length = unpack('n', $header)[1] ?? 0;
7777
$msg .= $this->connection->read($length);

0 commit comments

Comments
 (0)