Description
Symfony version(s) affected
5.4.21,6.2.7
Description
In a query part of an URL the plus sign ("+") is a placeholder for a space, so it has to be encoded with "%2B".
In the commit that is fixing the issue which is included in versions 5.4.21
and 6.2.7
the bug has been introduced.
The merge request refers to this stackoverflow thread which describes this as "special meaning".
How to reproduce
HttpClient::create()->request('GET', 'your-url', [
'query' => [
'dateTime' => '2022-11-24T18:00:00+01:00'
]
]);
Possible Solution
Remove the special processing for unquoting + signs in the query parts.
Additional Context
PHP provides (hopefully) standard compliant functions like urlencode()
/ rawurlencode()
/ http_build_query()
and they are used here in the code, but the results are modified afterwards.
Maybe it is better to fix such fundamental things directly in PHP and not in a user space library.
The current code of HttpClientTrait.php
is very complicated, so I am afraid of opening a merge request. Maybe it is useful to rethink the code (for 6.3 or 6.4), where to use urlencode()
and where rawurlencode()
and if it is possible to more rely on plain PHP to reduce complexity.