From b9d282d542780d231c3ffe79a6eb8b1bcabf0bd6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 27 Jun 2022 14:10:10 +0200 Subject: [PATCH] Stop faking custom URLs for controllers classes with exactly two consecutive uppercase characters This was introduced in 519f15c7700222357952e8cab41bbe960730c7fd and its purpose is not entirely clear: Everything works identically even without this, even in WoltLab Suite 5.5. RoutingCacheBuilder is only ever used within ControllerMap and within ControllerMap there are just a few locations where custom URLs are processed: - resolve(): This enforces that renamed controllers are accessed via their canonical URL. Not relevant here, because we are already working with the canonical URL and it's not an intentional rename. - resolveCustomController(): This is what we intent to avoid. If this method does not match, then `->resolve()` will correctly match. - lookup(): `self::transformController()` will perform the correct transformation. - lookupCmsPage(): Not relevant, because we do not deal with CMS pages. --- .../builder/RoutingCacheBuilder.class.php | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/wcfsetup/install/files/lib/system/cache/builder/RoutingCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/RoutingCacheBuilder.class.php index 31d558c50e..5516327e89 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/RoutingCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/RoutingCacheBuilder.class.php @@ -23,16 +23,6 @@ use wcf\util\FileUtil; */ class RoutingCacheBuilder extends AbstractCacheBuilder { - /** - * list of controllers violating the url schema, but are - * supported for legacy reasons - * @var array - */ - protected $brokenControllers = [ - 'lookup' => [], - 'reverse' => [], - ]; - /** * @inheritDoc */ @@ -175,10 +165,8 @@ class RoutingCacheBuilder extends AbstractCacheBuilder // fix for invalid pages that would cause single character fragments $sanitizedParts = []; $tmp = ''; - $isBrokenController = false; foreach ($parts as $part) { if (\strlen($part) === 1) { - $isBrokenController = true; $tmp .= $part; continue; } @@ -195,15 +183,6 @@ class RoutingCacheBuilder extends AbstractCacheBuilder $className = $abbreviation . '\\' . ($libDirectory === 'lib/acp' ? 'acp\\' : '') . $pageType . '\\' . $filename; $data[$abbreviation][$libDirectory === 'lib' ? 'frontend' : 'acp'][$ciController] = $className; - - if ($isBrokenController) { - $this->brokenControllers['lookup'][$abbreviation][$ciController] = $className; - $this->brokenControllers['reverse'][$abbreviation][\preg_replace( - '~(?:Page|Form|Action)$~', - '', - $filename - )] = $ciController; - } } } } @@ -275,17 +254,6 @@ class RoutingCacheBuilder extends AbstractCacheBuilder } } - // masquerade broken controllers as custom urls - foreach ($this->brokenControllers as $type => $brokenControllers) { - foreach ($brokenControllers as $application => $controllers) { - foreach ($controllers as $key => $value) { - if (!isset($data[$type][$application][$key])) { - $data[$type][$application][$key] = $value; - } - } - } - } - return $data; } -- 2.20.1