Merge remote branch 'udat/router/empty-string-as-default-parameter-value'
This commit is contained in:
commit
ef87ca3d75
@ -212,7 +212,7 @@ class RouteCompiler implements RouteCompilerInterface
|
||||
$this->segments[] = preg_quote($separator, '#').'(?P<'.$variable.'>'.$requirement.')';
|
||||
$this->variables[$variable] = $name;
|
||||
|
||||
if (!$this->route->getDefault($variable)) {
|
||||
if (null === $this->route->getDefault($variable)) {
|
||||
$this->firstOptional = count($this->segments);
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ class RouteCompilerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
array(
|
||||
'Route with several variables that have default values',
|
||||
array('/foo/{bar}/{foobar}', array('bar' => 'bar', 'foobar' => 'foobar')),
|
||||
array('/foo/{bar}/{foobar}', array('bar' => 'bar', 'foobar' => '')),
|
||||
'/foo', '#^/foo(?:/(?P<bar>[^/\.]+?) (?:/(?P<foobar>[^/\.]+?) )?)?$#x', array('bar' => '{bar}', 'foobar' => '{foobar}'), array(
|
||||
array('variable', '/', '{foobar}', 'foobar'),
|
||||
array('variable', '/', '{bar}', 'bar'),
|
||||
|
Reference in New Issue
Block a user