Move local `$controller` variable into a more appropriate "scope" in RequestHandler...
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 20 May 2022 12:30:56 +0000 (14:30 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 20 May 2022 12:30:56 +0000 (14:30 +0200)
The variable is only referenced in the `else`, move it there to make the data
flow clearer.

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

index f848de4d8f9c73a57825f2e8232095c121e6eaed..66eedc991518a530e30fdce0a5ba2cd5ea08031e 100644 (file)
@@ -147,8 +147,6 @@ class RequestHandler extends SingletonFactory
                 $routeData['controller'] = 'index';
             }
 
-            $controller = $routeData['controller'];
-
             if (isset($routeData['className'])) {
                 $classData = [
                     'className' => $routeData['className'],
@@ -158,6 +156,8 @@ class RequestHandler extends SingletonFactory
                 unset($routeData['className']);
                 unset($routeData['controller']);
             } else {
+                $controller = $routeData['controller'];
+
                 if (
                     $this->isACPRequest()
                     && ($controller === 'login' || $controller === 'index')