diff --git a/src/Routing/RouteCollection.php b/src/Routing/RouteCollection.php
index 30d350e1e31..ae81efc53f2 100644
--- a/src/Routing/RouteCollection.php
+++ b/src/Routing/RouteCollection.php
@@ -79,9 +79,11 @@ public function add(Route $route, array $options = [])
// Explicit names
if (isset($options['_name'])) {
if (isset($this->_named[$options['_name']])) {
+ $matched = $this->_named[$options['_name']];
throw new DuplicateNamedRouteException([
'name' => $options['_name'],
- 'url' => $this->_named[$options['_name']]->template
+ 'url' => $matched->template,
+ 'duplicate' => $matched,
]);
}
$this->_named[$options['_name']] = $route;
diff --git a/src/Template/Error/duplicate_named_route.ctp b/src/Template/Error/duplicate_named_route.ctp
index 64c795d37d5..068cf833f38 100644
--- a/src/Template/Error/duplicate_named_route.ctp
+++ b/src/Template/Error/duplicate_named_route.ctp
@@ -42,28 +42,21 @@ Remove duplicate route names in your route configuration.
-Connected Routes
-
-Template | Defaults | Options |
-options['_name']) && $url === $route->options['_name']) :
- echo '';
- else :
- echo '
';
- endif;
+
+ Duplicate Route
+
+ Template | Defaults | Options |
+ ';
printf(
'%s | %s | %s | ',
- $route->template,
- Debugger::exportVar($route->defaults),
- Debugger::exportVar($route->options)
+ $other->template,
+ Debugger::exportVar($other->defaults),
+ Debugger::exportVar($other->options)
);
echo '';
-endforeach;
-?>
-
+ ?>
+
+
end() ?>