Stop adding the `isDefaultController` value to `$routeData` in RequestHandler
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 23 Jun 2022 15:00:26 +0000 (17:00 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 23 Jun 2022 15:00:26 +0000 (17:00 +0200)
The `$routeData` array is only processed locally, except when it is passed to
LinkHandler for renamed controllers (which can't happen for default
controllers), thus this is completely redundant with simply checking
`->isDefaultController()` in the other places, with the latter being much more
clear, because one does not need to think about where the `$routeData` might
end up.

wcfsetup/install/files/lib/system/request/RequestHandler.class.php

index 8250deb25bc91e34647d70c2f5d4b834e4b19903..4398557943024b17e1978a66a810072bbfd60575 100644 (file)
@@ -140,8 +140,6 @@ final class RequestHandler extends SingletonFactory
                     foreach ($data as $key => $value) {
                         $routeData[$key] = $value;
                     }
-
-                    $routeData['isDefaultController'] = true;
                 }
             }
 
@@ -165,7 +163,7 @@ final class RequestHandler extends SingletonFactory
 
                 $classApplication = $application;
                 if (
-                    !empty($routeData['isDefaultController'])
+                    RouteHandler::getInstance()->isDefaultController()
                     && !empty($routeData['application'])
                     && $routeData['application'] !== $application
                 ) {
@@ -199,7 +197,9 @@ final class RequestHandler extends SingletonFactory
             }
 
             // handle CMS page meta data
-            $metaData = ['isDefaultController' => (!empty($routeData['isDefaultController']))];
+            $metaData = [
+                'isDefaultController' => RouteHandler::getInstance()->isDefaultController()
+            ];
             if (isset($routeData['cmsPageID'])) {
                 $metaData['cms'] = [
                     'pageID' => $routeData['cmsPageID'],