From a56ada72889d28ccba42227e22d1f32dd6651ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Fr=C4=85cz?= Date: Mon, 24 Apr 2017 10:03:08 +0200 Subject: [PATCH] Return immediately if request is not json Fetching the contents before this check may result in OutOfMemory excpetion if the request is multipart with files. --- .../EventListener/JsonRequestTransformerListener.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Qandidate/Common/Symfony/HttpKernel/EventListener/JsonRequestTransformerListener.php b/src/Qandidate/Common/Symfony/HttpKernel/EventListener/JsonRequestTransformerListener.php index 147129f..c7f3d80 100755 --- a/src/Qandidate/Common/Symfony/HttpKernel/EventListener/JsonRequestTransformerListener.php +++ b/src/Qandidate/Common/Symfony/HttpKernel/EventListener/JsonRequestTransformerListener.php @@ -27,13 +27,13 @@ public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); - $content = $request->getContent(); - - if (empty($content)) { + if (! $this->isJsonRequest($request)) { return; } + + $content = $request->getContent(); - if (! $this->isJsonRequest($request)) { + if (empty($content)) { return; }