Skip to content

Problem passing query parameters to redirected Url #26256

@cooldude77

Description

@cooldude77
Q A
Bug report? yes
Feature request? no
BC Break report? not sure
RFC? not sure
Symfony version 2.8.+

Here is one of my route

v2_rest_connections_status_with_self_connected_all_paged:
    pattern:  api/v2/connections/self/with/users/status/connectedSince/pages/{page}
    defaults:
        _controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
        route: rest_connections_status_with_self_connected_all_paged
        permanent: false

And this redirects to

rest_connections_status_with_self_connected_since:
    pattern:  api/v1/connections/self/with/users/status/connectedSince
    defaults: { _controller: MyCardRestBundle:Connection:getAllUsersConnectedWithSelf}
    methods: [GET]

So a sample URI for testing would be

'api/v2/connections/self/with/users/status/connectedSince/pages/1'

But there could be more get params supplied by client, which may not form part of url in routing( look at the params after ? mark)

'api/v2/connections/self/with/users/status/connectedSince/pages/1?device=android&density=XXHDPI&xy=blah',

Since the routes have same number of parameter {page} gets passed correctly but the device and density are not passed to the 'routed to' controller.

The problem could be that RedirectController does not look for the request parameter at line 65.

return new RedirectResponse($this->container->get('router')->generate($route, $attributes, UrlGeneratorInterface::ABSOLUTE_URL), $code);

Adding to route params also does not help as density value for example is not copied

And since target controller does not receive right request, it does not get the params leading to

Either device or density information is missing (404 Not Found)

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