Bug fix: yes
Feature addition: no
Backwards compatibility break: If someone relied no this bug, yes
Symfony2 tests pass: yes
Fixes the following tickets: -
I sometimes have routes like the following used purely for generating a url, whether that be to the symfony app or an external app:
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 ?
[Routing] fixed route generation when pattern already has question mark
The route pattern is just about the URL path, and as such it must not contain the query string.
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.
Yea you're right, I didn't think that one through enough. Thanks for the comments