From 70acf102b73aff7c23174cc4390e29b9fe66d5e4 Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Thu, 3 Mar 2016 12:47:11 +0100 Subject: [PATCH] [BUGFIX] Allow overriding of Backend Routes Adding backend routes from Configuration/Backend/Routes.php is done via "+=" operator which does not allow to override routes with the same name. This is however a wanted behaviour - allowing extensions to override core routes. The patch changes the "+=" operator to a simple array_merge() call to allow to change existing routes. Resolves: #74004 Releases: master, 7.6 Change-Id: I7caf1ab5a91f849b4789ea352c20af6239470f2f Reviewed-on: https://review.typo3.org/47005 Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Reviewed-by: Thomas Schlumberger <thomas@b13.de> Tested-by: Thomas Schlumberger <thomas@b13.de> Reviewed-by: Frank Naegler <frank.naegler@typo3.org> Tested-by: Frank Naegler <frank.naegler@typo3.org> --- typo3/sysext/core/Classes/Core/Bootstrap.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/typo3/sysext/core/Classes/Core/Bootstrap.php b/typo3/sysext/core/Classes/Core/Bootstrap.php index 3b1724213b22..f95f1cbf9bee 100644 --- a/typo3/sysext/core/Classes/Core/Bootstrap.php +++ b/typo3/sysext/core/Classes/Core/Bootstrap.php @@ -1010,8 +1010,6 @@ class Bootstrap */ public function initializeBackendRouter() { - $packageManager = $this->getEarlyInstance(\TYPO3\CMS\Core\Package\PackageManager::class); - // See if the Routes.php from all active packages have been built together already $cacheIdentifier = 'BackendRoutesFromPackages_' . sha1((TYPO3_version . PATH_site . 'BackendRoutesFromPackages')); @@ -1023,13 +1021,14 @@ class Bootstrap $routesFromPackages = unserialize(substr($codeCache->get($cacheIdentifier), 6, -2)); } else { // Loop over all packages and check for a Configuration/Backend/Routes.php file + $packageManager = $this->getEarlyInstance(\TYPO3\CMS\Core\Package\PackageManager::class); $packages = $packageManager->getActivePackages(); foreach ($packages as $package) { $routesFileNameForPackage = $package->getPackagePath() . 'Configuration/Backend/Routes.php'; if (file_exists($routesFileNameForPackage)) { $definedRoutesInPackage = require $routesFileNameForPackage; if (is_array($definedRoutesInPackage)) { - $routesFromPackages += $definedRoutesInPackage; + $routesFromPackages = array_merge($routesFromPackages, $definedRoutesInPackage); } } $routesFileNameForPackage = $package->getPackagePath() . 'Configuration/Backend/AjaxRoutes.php'; -- GitLab