diff --git a/src/BufferingParser.php b/src/BufferingParser.php index af6f023..de8824d 100644 --- a/src/BufferingParser.php +++ b/src/BufferingParser.php @@ -73,7 +73,7 @@ private function parseBody(string $body, string $boundary = null): Form $fields[$field][] = $value; } - if (\strpos($value ?? "", "&") !== false) { + if (\strpos($pair[1] ?? "", "&") !== false) { throw new ParseException("Maximum number of variables exceeded"); } diff --git a/src/BufferingParserTest.php b/src/BufferingParserTest.php new file mode 100644 index 0000000..333ec83 --- /dev/null +++ b/src/BufferingParserTest.php @@ -0,0 +1,22 @@ +createMock(Client::class), 'GET', Http::createFromString('/'), [], $body); + $form = wait((new BufferingParser)->parseForm($request)); + + $this->assertSame('&', $form->getValue('foobar')); + } + +}