symfony/symfony — pull request #5410 by Tobion (2012-09-01 02:39:12+00:00)
Title: [Routing] allow URLs to be generated that include the default param

BC break: yes (even if no test needed to be changed, so the old behavior was probably not even intended as no test for it existed)
Fixes #5180

This can be achieved by explicitly passing the parameter. Previously it just ignored the parameter that equals the default value. You can still omit optional variables by not passing it at all or passing null as param value.

Example:
Given the route `new Route('/index.{_format}', array('_format' => 'html'));`
Previously generating this route with params `array('_format' => 'html')` resulted in `/index` which means one could not generate `/index.html` at all. This has been changed. You can of course still generate just `/index` by passing array('_format' => null) or not passing the param at all.

I'm certain this is the best solution to the problem even if it slightly breaks bc. But IMO this is how it is supposed to work. Because when I pass a parameter explicitly, I want it to be included in the URL.