Inline RequestHandler::sendPsr7Response()
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 19 May 2022 14:11:57 +0000 (16:11 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 20 May 2022 07:22:24 +0000 (09:22 +0200)
wcfsetup/install/files/lib/system/request/RequestHandler.class.php

index 1d36882fd4a5f411dff8e194bc500206ca1e544b..43a93b59dbe348d9115058bc9c50f9b4aa0ec64a 100644 (file)
@@ -4,7 +4,6 @@ namespace wcf\system\request;
 
 use Laminas\Diactoros\ServerRequestFactory;
 use Laminas\HttpHandlerRunner\Emitter\SapiEmitter;
-use Psr\Http\Message\ResponseInterface;
 use wcf\http\LegacyPlaceholderResponse;
 use wcf\http\middleware\EnforceCacheControlPrivate;
 use wcf\http\middleware\EnforceFrameOptions;
@@ -110,9 +109,14 @@ class RequestHandler extends SingletonFactory
                 new EnforceFrameOptions(),
             ]);
 
-            $this->sendPsr7Response(
-                $pipeline->process($psrRequest, $this->getActiveRequest())
-            );
+            $response = $pipeline->process($psrRequest, $this->getActiveRequest());
+
+            if ($response instanceof LegacyPlaceholderResponse) {
+                return;
+            }
+
+            $emitter = new SapiEmitter();
+            $emitter->emit($response);
         } catch (NamedUserException $e) {
             $e->show();
 
@@ -120,19 +124,6 @@ class RequestHandler extends SingletonFactory
         }
     }
 
-    /**
-     * @since 5.5
-     */
-    private function sendPsr7Response(ResponseInterface $response)
-    {
-        if ($response instanceof LegacyPlaceholderResponse) {
-            return;
-        }
-
-        $emitter = new SapiEmitter();
-        $emitter->emit($response);
-    }
-
     /**
      * Builds a new request.
      *