From d7c6d21186ee5ea511cc5ed9a55faaabd15f3fb8 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Thu, 21 Jul 2022 12:59:37 +0200
Subject: [PATCH] Bypass Symfony check for writable log-dir

Bypass Symfony check for writable log-dir for the case where we configured syslog/errlog/stderr
---
 src/SimpleSAML/Kernel.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/SimpleSAML/Kernel.php b/src/SimpleSAML/Kernel.php
index 3473a0fa6..344b1bcf9 100644
--- a/src/SimpleSAML/Kernel.php
+++ b/src/SimpleSAML/Kernel.php
@@ -66,7 +66,13 @@ class Kernel extends BaseKernel
     public function getLogDir(): string
     {
         $configuration = Configuration::getInstance();
-        $loggingPath = $configuration->getString('loggingdir');
+        $handler = $configuration->getString('logging.handler');
+
+        if ($handler === 'file') {
+            $loggingPath = $configuration->getString('loggingdir');
+        } else {
+            $loggingPath = '/dev/null';
+        }
 
         $sysUtils = new System();
         if ($sysUtils->isAbsolutePath($loggingPath)) {
-- 
GitLab