8000 Dot / Underscore inputs inconsistent result after symfony/http-foundation 5.2 update · Issue #39546 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Dot / Underscore inputs inconsistent result after symfony/http-foundation 5.2 update #39546
Closed
@giggsey

Description

@giggsey

Symfony version(s) affected: 5.2.0

Description

#37272 introduced better handling for dots in query strings by no longer converting them to underscores.

Unfortunately, there are now different results when running this via unit tests or the browser.

How to reproduce

Controller

    public function index(Request $request)
    {
        return new JsonResponse($request->query->all());
    }

Test

    public function testIndex(): void
    {
        $client = static::createClient();
        $client->request('GET', '/en/blog/?bla.one=testing');

        $this->assertSame(
            json_decode($client->getResponse()->getContent(), true),
            [
                'bla.one' => 'testing',
            ]
        );
    }

The test passes, but when running it via a browser (using symfony serve)

image

(Both return the same when using 5.1)

Further detail

Going via the web calls Request::createFromGlobals(), but unit tests call Request::create() (which calls the changed parseQuery).

Replaces laravel/framework#35616

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

      0