Do not take `routeData` by reference in RequestHandler::handleDefaultController()
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 20 May 2022 12:38:37 +0000 (14:38 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 20 May 2022 12:58:46 +0000 (14:58 +0200)
By returning the updated data the data flow becomes clearer.

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

index 109f9824658f915a7b16a1d7122914b0300e66de..56a999f10a600bdf456429d8cdb78a387ed30b2f 100644 (file)
@@ -124,7 +124,7 @@ final class RequestHandler extends SingletonFactory
 
             // handle landing page for frontend requests
             if (!$this->isACPRequest()) {
-                $this->handleDefaultController($application, $routeData);
+                $routeData = $this->handleDefaultController($application, $routeData);
 
                 // check if accessing from the wrong domain (e.g. "www." omitted but domain was configured with)
                 $domainName = ApplicationHandler::getInstance()->getDomainName();
@@ -267,10 +267,10 @@ final class RequestHandler extends SingletonFactory
      * @param string[] $routeData
      * @throws  IllegalLinkException
      */
-    protected function handleDefaultController($application, array &$routeData)
+    protected function handleDefaultController(string $application, array $routeData): array
     {
         if (!RouteHandler::getInstance()->isDefaultController()) {
-            return;
+            return $routeData;
         }
 
         $data = ControllerMap::getInstance()->lookupDefaultController($application);
@@ -308,6 +308,8 @@ final class RequestHandler extends SingletonFactory
         }
 
         $routeData['isDefaultController'] = true;
+
+        return $routeData;
     }
 
     /**