Skip to content

Query parameters are incorrectly normalized in IriHelper #5221

Description

@4rthem

API Platform version(s) affected: 3.0.4

Description

If you pass array of array in query, the next page got from IriHelper is not correct.

How to reproduce

Call your API endpoint with multi-dimensional array params:

GET https://my-api/objects?filters[0][a]=foo&filters[0][b]=bar

In PHP we can access filters[0]['a'] and filters[0]['b']

But the next URL from hydra response is something like:

https://my-api/objects?page=2&filters[][a]=foo&filters[][b]=bar

So in PHP the filters structure is altered and filters[0]['b'] is not defined.

Possible Solution

Remove preg_replace('/%5B\d+%5D/', '%5B%5D', $query) from IriHelper::createIri.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions