Skip to content

Commit 094cc40

Browse files
committed
[0.6.x] Solve PHP 8.5 chr PHPStan out of bounds warning
1 parent e3015ca commit 094cc40

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/Protocol/ProtocolReader.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,12 @@ public function consumeFieldValue(Buffer $buffer): mixed
280280
return null;
281281

282282
default:
283+
if ($fieldType < 0 || $fieldType > 255) {
284+
throw new ProtocolException(
285+
sprintf('Unhandled field type 0x%02x, out of bounds value.', $fieldType),
286+
);
287+
}
288+
283289
throw new ProtocolException(
284290
sprintf('Unhandled field type 0x%02x', $fieldType) .
285291
(ctype_print(chr($fieldType)) ? " ('" . chr($fieldType) . "')" : '') .

0 commit comments

Comments
 (0)