Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HttpClient] Query parameters with plus sign ("+") are not quoted anymore #49579

Copy link
Copy link
Closed
@pl-github

Description

@pl-github
Issue body actions

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.