Skip to content

Bug: symfony/http-foundation fails to parse complex queries in v5.2.0 #39307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aimeos opened this issue Dec 4, 2020 · 1 comment
Closed

Comments

@aimeos
Copy link
Contributor

aimeos commented Dec 4, 2020

Symfony version(s) affected: symfony/http-foundation:5.2.0

Description

The new code fails to parse more complex query parameters like:
filter[&&][==][product.code]=demo
which is sent as:
filter[%26%26][%3D%3D][product.code]=demo

The result is something like:

    []] => Array
        (
            [0] => =][product.code]=demo
        )

which is invalid and hex2bin() then reports:
hex2bin(): Hexadecimal input string must have an even length

Possible Solution

The problem is the custom parseQuery() method which fails to parse such input correctly:

symfony/http-foundation@v5.1.9...v5.2.0#diff-b6d0c8db4eac8fff2ef3214f93fdf07ad0c161ba4d238a514ba4ab6633dfea9dR196-R253

The PHP parse_str() method used in v5.1.9 works fine.

@derrabus
Copy link
Member

derrabus commented Dec 4, 2020

That method was added with #37272 (cc @nicolas-grekas).

fabpot added a commit that referenced this issue Dec 8, 2020
… query string (nicolas-grekas)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] fix preserving some special chars in the query string

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #39307
| License       | MIT
| Doc PR        | -

Commits
-------

6ecae57 [FrameworkBundle] fix preserving some special chars in the query string when redirecting
@fabpot fabpot closed this as completed Dec 8, 2020
fabpot added a commit that referenced this issue Dec 8, 2020
…rUtils::parseQuery() (nicolas-grekas)

This PR was merged into the 5.2 branch.

Discussion
----------

[HttpFoundation] fix parsing some special chars with HeaderUtils::parseQuery()

| Q             | A
| ------------- | ---
| Branch?       | 5.2
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #39307
| License       | MIT
| Doc PR        | -

Same as #39357 for 5.2

Commits
-------

8682bdc [HttpFoundation] fix parsing some special chars with HeaderUtils::parseQuery()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants