Skip to content

[Routing] fixed route generation when pattern already has question mark #4191

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
wants to merge 1 commit into from
Closed

[Routing] fixed route generation when pattern already has question mark #4191

wants to merge 1 commit into from

Conversation

danielholmes
Copy link
Contributor

Bug fix: yes
Feature addition: no
Backwards compatibility break: If someone relied no this bug, yes
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

I sometimes have routes like the following used purely for generating a url, whether that be to the symfony app or an external app:

blog_news:
    pattern:  /blog/?category=news

When generating this route with extra parameters, the url it generates is invalid.

$router->generate('blog_news', array('page' => 2));
// results in /blog/?category=news?page=2

I've changed the generator to use & if the url already has a ?

@fabpot
Copy link
Member

fabpot commented May 3, 2012

The route pattern is just about the URL path, and as such it must not contain the query string.

@Tobion
Copy link
Contributor

Tobion commented May 3, 2012

The question mark in the path should be encoded. See #4166.
Then the route will be valid. But as fabpot said, the query string doesn't belong in the route pattern anyway.

@danielholmes
Copy link
Contributor Author

Yea you're right, I didn't think that one through enough. Thanks for the comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants