Skip to content

Commit

Permalink
[Routing] fixed generation when a default value is null
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jun 3, 2011
1 parent 79a611f commit df81296
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Routing/Generator/UrlGenerator.php
Expand Up @@ -108,7 +108,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
$optional = true;
foreach ($tokens as $token) {
if ('variable' === $token[0]) {
if (false === $optional || !isset($defaults[$token[3]]) || (isset($parameters[$token[3]]) && $parameters[$token[3]] != $defaults[$token[3]])) {
if (false === $optional || !array_key_exists($token[3], $defaults) || (isset($parameters[$token[3]]) && $parameters[$token[3]] != $defaults[$token[3]])) {
if (!$isEmpty = in_array($tparams[$token[3]], array(null, '', false), true)) {
// check requirement
if ($tparams[$token[3]] && !preg_match('#^'.$token[2].'$#', $tparams[$token[3]])) {
Expand Down

0 comments on commit df81296

Please sign in to comment.