Closed
Description
There some bug in a postfields parsing in file
https://github.com/reactphp/http/blob/master/src/RequestParser.php#L138
Need to replace
parse_str(urldecode($content), $result);with
parse_str($content, $result);Example:
// example postfields
$data = [
'url' => 'http://somedomain/?field1=v1&field2=v2',
'flag' => 1
];
$string = http_build_query($data);
// encoded to post body as
// url=http%3A%2F%2Fsomedomain%2F%3Ffield1%3Dv1%26field2%3Dv2&flag=1
// So, right way to parse
$result = null;
parse_str($string, $result);
var_dump($result);
array(2) {
'url' =>
string(38) "http://somedomain/?field1=v1&field2=v2"
'flag' =>
string(1) "1"
}
// and wrong way to parse
$result = null;
parse_str(urldecode($string), $result);
var_dump($result);
array(3) {
'url' =>
string(28) "http://somedomain/?field1=v1"
'field2' =>
string(2) "v2"
'flag' =>
string(1) "1"
}Metadata
Metadata
Assignees
Labels
No labels
Activity
Fixes reactphp#44 - postfields parsing without urldecode
greevex commentedon Oct 28, 2015
Is there any alive owners here?
Merge pull request #45 from greevex/greevex-issue-44-postfields-fix
WyriHaximus commentedon Oct 28, 2015
Yes although we might not always respond quickly. Thanks for the bug report and PR, currently I'm in the middle of refactoring the request parsing #41 and I'll make sure this bug won't slip back in through that
greevex commentedon Oct 28, 2015
@WyriHaximus Thank you! We use this library in few projects and it's awesome!
https://github.com/reactphp/http/issues/44#issuecomment-151941120