Make \wcf\system\request\Request externally immutable
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 3 Jun 2022 10:30:11 +0000 (12:30 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 7 Jun 2022 14:11:40 +0000 (16:11 +0200)
wcfsetup/install/files/lib/system/request/Request.class.php
wcfsetup/install/files/lib/system/request/RequestHandler.class.php

index 772d2986b008516747ca1139b2ec0ae7104177d3..3f362cbce0568980c564109f945575e726567a20 100644 (file)
@@ -53,18 +53,11 @@ final class Request implements RequestHandlerInterface
      * @param string $className fully qualified name
      * @param string[] $metaData additional meta data
      */
-    public function __construct($className, array $metaData)
+    public function __construct($className, array $metaData, bool $isLandingPage)
     {
         $this->className = $className;
         $this->metaData = $metaData;
-    }
-
-    /**
-     * Marks this request as landing page.
-     */
-    public function setIsLandingPage()
-    {
-        $this->isLandingPage = true;
+        $this->isLandingPage = $isLandingPage;
     }
 
     /**
index 87d223da771847367570723580c3bc5e03add80c..2b38ac05d885aaef30956c1e2bc7a94fd693ab03 100644 (file)
@@ -200,15 +200,9 @@ final class RequestHandler extends SingletonFactory
 
             $this->activeRequest = new Request(
                 $className,
-                $metaData
+                $metaData,
+                !$this->isACPRequest() && ControllerMap::getInstance()->isLandingPage($className, $metaData)
             );
-
-            if (!$this->isACPRequest()) {
-                // determine if current request matches the landing page
-                if (ControllerMap::getInstance()->isLandingPage($className, $metaData)) {
-                    $this->activeRequest->setIsLandingPage();
-                }
-            }
         } catch (SystemException $e) {
             if (
                 \defined('ENABLE_DEBUG_MODE')