From 1ac4c8b55d9072353689f74630616298109791c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be>
Date: Mon, 4 Jun 2018 17:03:46 +0200
Subject: [PATCH] :ambulance: fix(core) sonar fix

issue #5840
---
 include/class_CSRFProtection.inc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/class_CSRFProtection.inc b/include/class_CSRFProtection.inc
index dec9a5b17..a2d814888 100644
--- a/include/class_CSRFProtection.inc
+++ b/include/class_CSRFProtection.inc
@@ -61,10 +61,8 @@ class CSRFProtection
       if (!empty($_SERVER['HTTP_HOST'])) {
         $target = $_SERVER['HTTP_HOST'];
       }
-      if ($target) {
-        if (!hash_equals($origin, $target)) {
-          throw new FusionDirectoryException('CSRF detected: origin and target are not matching ('.$origin.' != '.$target.')');
-        }
+      if ($target && !hash_equals($origin, $target)) {
+        throw new FusionDirectoryException('CSRF detected: origin and target are not matching ('.$origin.' != '.$target.')');
       }
     }
   }
-- 
GitLab