Support `RequestHandlerInterface`-based controllers in `wcf\system\request\Request`
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 19 May 2022 13:15:16 +0000 (15:15 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 19 May 2022 13:16:13 +0000 (15:16 +0200)
wcfsetup/install/files/lib/system/request/Request.class.php

index 7cc51e507fac9d2acde9f01fc732891e9835b290..d20c144faea70052dbf559201957bc25fdbf3138 100644 (file)
@@ -92,13 +92,17 @@ final class Request implements RequestHandlerInterface
             $this->requestObject = new $this->className();
         }
 
-        $response = $this->requestObject->__run();
+        if ($this->requestObject instanceof RequestHandlerInterface) {
+            return $this->requestObject->handle($request);
+        } else {
+            $response = $this->requestObject->__run();
 
-        if ($response instanceof ResponseInterface) {
-            return $response;
+            if ($response instanceof ResponseInterface) {
+                return $response;
+            } else {
+                return new LegacyPlaceholderResponse();
+            }
         }
-
-        return new LegacyPlaceholderResponse();
     }
 
     /**