Skip to content

Commit 9a89475

Browse files
committed
Allow chunk size to be encoded with uppercase hexadecimal digits
1 parent d70adc7 commit 9a89475

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/ChunkedStreamDecoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ protected function iterateBuffer()
117117
$lengthChunk = "0";
118118
}
119119
}
120-
if (dechex(hexdec($lengthChunk)) !== $lengthChunk) {
120+
if (dechex(hexdec($lengthChunk)) !== strtolower($lengthChunk)) {
121121
$this->emit('error', [
122122
new Exception('Unable to validate "' . $lengthChunk . '" as chunk length header'),
123123
]);

tests/DecodeChunkedStreamTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ public function provideChunkedEncoding()
7373
],
7474
'end-chunk-zero-check-3' => [
7575
["00004\r\nWiki\r\n005\r\npedia\r\ne\r\n in\r\n\r\nchunks.\r\n0000\r\n\r\n"]
76+
],
77+
'uppercase-chunk' => [
78+
["4\r\nWiki\r\n5\r\npedia\r\nE\r\n in\r\n\r\nchunks.\r\n0\r\n\r\n"],
7679
]
7780
];
7881
}

0 commit comments

Comments
 (0)