From d3fbbbcf65e4eda2ab3d0c95bb10ede06396b85c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Gonz=C3=A1lez?= Date: Tue, 27 Feb 2018 15:13:57 +0000 Subject: [PATCH] refs #10778 mark routes intialized in setRouteCollection --- src/Routing/Middleware/RoutingMiddleware.php | 4 +--- src/Routing/Router.php | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Routing/Middleware/RoutingMiddleware.php b/src/Routing/Middleware/RoutingMiddleware.php index 3149a906995..7c9fd29162f 100644 --- a/src/Routing/Middleware/RoutingMiddleware.php +++ b/src/Routing/Middleware/RoutingMiddleware.php @@ -14,7 +14,6 @@ */ namespace Cake\Routing\Middleware; -======= use Cake\Cache\Cache; use Cake\Core\Configure; use Cake\Core\PluginApplicationInterface; @@ -74,10 +73,9 @@ protected function loadRoutes() if (!$this->app) { return; } + $routeCollection = $this->buildRouteCollection(); Router::setRouteCollection($routeCollection); - // Prevent routes from being loaded again - Router::$initialized = true; } /** diff --git a/src/Routing/Router.php b/src/Routing/Router.php index 8611a15a50f..57cd65b26c1 100644 --- a/src/Routing/Router.php +++ b/src/Routing/Router.php @@ -1157,6 +1157,7 @@ public static function getRouteCollection() public static function setRouteCollection($routeCollection) { static::$_collection = $routeCollection; + Router::$initialized = true; } /**