From d47f14cae0193f37940038c8f862932c9c417f2c Mon Sep 17 00:00:00 2001 From: Max Roeleveld Date: Fri, 19 Oct 2018 11:59:58 +0200 Subject: [PATCH] Fix notices about missing indices Make sure we have a requirements/_locale key in a route before blindly checking it against a string. This would result in notices thrown about missing indices. If the key isn't set at all in the route, we should just blindly apply the default. --- src/Frontend/LocalizedFrontend.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Frontend/LocalizedFrontend.php b/src/Frontend/LocalizedFrontend.php index 090e928..a93dbd4 100644 --- a/src/Frontend/LocalizedFrontend.php +++ b/src/Frontend/LocalizedFrontend.php @@ -24,7 +24,10 @@ protected function getConfigurationRoutes() } foreach ($routes as $name => &$route) { - if ($name !== 'preview' && $route['requirements']['_locale'] != 'none') { + if ( + $name !== 'preview' + && (!isset($route['requirements']['_locale']) || $route['requirements']['_locale'] != 'none') + ) { $route['path'] = '/{_locale}' . $route['path']; $route['requirements']['_locale'] = $requirements; }