Use PSR-7 responses in MessageQuoteAction
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 10 Aug 2021 13:25:29 +0000 (15:25 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 11 Aug 2021 14:29:54 +0000 (16:29 +0200)
wcfsetup/install/files/lib/action/MessageQuoteAction.class.php

index ea467dbd781b88563ff554f3f48394942855be95..837488ff8c187fc045fd0a303d1e199ac13729dd 100644 (file)
@@ -2,12 +2,13 @@
 
 namespace wcf\action;
 
+use Laminas\Diactoros\Response\EmptyResponse;
+use Laminas\Diactoros\Response\JsonResponse;
 use wcf\system\exception\SystemException;
 use wcf\system\exception\UserInputException;
 use wcf\system\message\quote\MessageQuoteManager;
 use wcf\system\WCF;
 use wcf\util\ArrayUtil;
-use wcf\util\JSON;
 use wcf\util\StringUtil;
 
 /**
@@ -131,12 +132,10 @@ class MessageQuoteAction extends AJAXProxyAction
         WCF::getSession()->disableUpdate();
 
         if ($returnValues !== null) {
-            // send JSON-encoded response
-            \header('Content-type: application/json; charset=UTF-8');
-            echo JSON::encode($returnValues);
+            return new JsonResponse($returnValues);
+        } else {
+            return new EmptyResponse(200);
         }
-
-        exit;
     }
 
     /**