Return LegacyPlaceholderResponse from `Request::execute()`
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 19 May 2022 12:52:04 +0000 (14:52 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 19 May 2022 13:04:35 +0000 (15:04 +0200)
wcfsetup/install/files/lib/system/request/Request.class.php

index a94444678464bba979fdfd6a9e1b073834c85aad..d65e5bd05bacd134130fd4407b46ac5e5c30fbe7 100644 (file)
@@ -2,7 +2,9 @@
 
 namespace wcf\system\request;
 
+use Psr\Http\Message\ResponseInterface;
 use wcf\data\page\PageCache;
+use wcf\http\LegacyPlaceholderResponse;
 
 /**
  * Represents a page request.
@@ -82,12 +84,18 @@ class Request
     /**
      * Executes this request.
      */
-    public function execute()
+    public function execute(): ResponseInterface
     {
         if ($this->requestObject === null) {
             $this->requestObject = new $this->className();
 
-            return $this->requestObject->__run();
+            $response = $this->requestObject->__run();
+
+            if ($response instanceof ResponseInterface) {
+                return $response;
+            }
+
+            return new LegacyPlaceholderResponse();
         }
     }