merged branch schmittjoh/routingFix (PR #7458)

This PR was merged into the 2.2 branch.

Discussion
----------

Reverts behavior change to UrlGenerator

I do not want to talk much about the behavior change and whether it makes sense or not because I think it does not matter in this situation anyway.

The ``generate`` method is tagged with ``@api``, there is no security issue that was fixed. According to the rules set forth at http://symfony.com/doc/current/book/stable_api.html, the semantics of such a method must not be changed.

There is some more discussion in #6814 and the commit changing the behavior is this one: c66d1f9de3 (diff-0)

Commits
-------

a765375 reverts some behavior changes made in c66d1f9de30fd1b6a86cca10dd79d12c9ba9ff25
This commit is contained in:
Fabien Potencier 2013-03-23 13:53:00 +01:00
commit 9885798dd1
2 changed files with 3 additions and 3 deletions

View File

@ -261,7 +261,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
}
// add a query string if needed
$extra = array_diff_key($parameters, $variables);
$extra = array_diff_key($parameters, $variables, $defaults);
if ($extra && $query = http_build_query($extra, '', '&')) {
$url .= '?'.$query;
}

View File

@ -297,8 +297,8 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
{
$routes = $this->getRoutes('test', new Route('/test', array('default' => 'value')));
$this->assertSame('/app.php/test?default=foo', $this->getGenerator($routes)->generate('test', array('default' => 'foo')));
$this->assertSame('/app.php/test?default=value', $this->getGenerator($routes)->generate('test', array('default' => 'value')));
$this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test', array('default' => 'foo')));
$this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test', array('default' => 'value')));
$this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test'));
}