[Routing] Fix PhpMatcherDump when url contains a . or a -
This commit is contained in:
parent
b2476719f6
commit
8a472b7d98
@ -61,7 +61,7 @@ class PhpMatcherDumper extends MatcherDumper
|
||||
}
|
||||
|
||||
if (!count($compiledRoute->getVariables()) && false !== preg_match('#^(.)\^(?P<url>.*?)\$\1#', $compiledRoute->getRegex(), $m)) {
|
||||
$conditions[] = sprintf("\$url === '%s'", $m['url']);
|
||||
$conditions[] = sprintf("\$url === '%s'", str_replace('\\', '', $m['url']));
|
||||
|
||||
$matches = 'array()';
|
||||
} else {
|
||||
|
@ -33,6 +33,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
||||
return array_merge($this->mergeDefaults(array(), array ()), array('_route' => 'baz'));
|
||||
}
|
||||
|
||||
if ($url === '/test/baz.html') {
|
||||
return array_merge($this->mergeDefaults(array(), array ()), array('_route' => 'baz2'));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,9 @@ class PhpMatcherDumperTest extends \PHPUnit_Framework_TestCase
|
||||
$collection->add('baz', new Route(
|
||||
'/test/baz'
|
||||
));
|
||||
$collection->add('baz2', new Route(
|
||||
'/test/baz.html'
|
||||
));
|
||||
|
||||
$dumper = new PhpMatcherDumper($collection);
|
||||
$this->assertStringEqualsFile(self::$fixturesPath.'/dumper/url_matcher1.php', $dumper->dump(), '->dump() dumps basic routes to the correct PHP file.');
|
||||
|
Reference in New Issue
Block a user