diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
index c1ed499c3f..1bc4d0d463 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
@@ -77,10 +77,7 @@ EOF
protected function outputRoutes(OutputInterface $output, $routes = null)
{
if (null === $routes) {
- $routes = array();
- foreach ($this->getContainer()->get('router')->getRouteCollection()->all() as $name => $route) {
- $routes[$name] = $route->compile();
- }
+ $routes = $this->getContainer()->get('router')->getRouteCollection()->all();
}
$output->writeln($this->getHelper('formatter')->formatSection('router', 'Current routes'));
@@ -131,7 +128,6 @@ EOF
$output->writeln($this->getHelper('formatter')->formatSection('router', sprintf('Route "%s"', $name)));
- $route = $route->compile();
$output->writeln(sprintf('Name %s', $name));
$output->writeln(sprintf('Pattern %s', $route->getPattern()));
$output->writeln(sprintf('Class %s', get_class($route)));
@@ -160,7 +156,7 @@ EOF
}
$output->writeln(sprintf('Options %s', $options));
$output->write('Regex ');
- $output->writeln(preg_replace('/^ /', '', preg_replace('/^/m', ' ', $route->getRegex())), OutputInterface::OUTPUT_RAW);
+ $output->writeln(preg_replace('/^ /', '', preg_replace('/^/m', ' ', $route->compile()->getRegex())), OutputInterface::OUTPUT_RAW);
}
protected function formatValue($value)