amphp/http-server-form-parser

Form parsing fails if last value contains a urlencoded &

brstgt opened this issue · 3 comments

            foreach (\explode("&", $body, $this->fieldCountLimit) as $pair) {
                $pair = \explode("=", $pair, 2);
                $field = \urldecode($pair[0]);
                $value = \urldecode($pair[1] ?? "");

                $fields[$field][] = $value;
            }

#Wrong
            if (\strpos($value ?? "", "&") !== false) {
                throw new ParseException("Maximum number of variables exceeded");
            }
#Right
            if (\strpos($$pair[1] ?? "", "&") !== false) {

Thanks! Do you want to provide that as a PR?

Sorry, was pretty busy so i was not able to provide a PR quickly. Thanks!

Dont worry, thanks again for the report!