From 1143bf85288344d4147c1d53273f63765f4d6441 Mon Sep 17 00:00:00 2001
From: Hanne Moa <hanne.moa@uninett.no>
Date: Tue, 12 Jul 2016 15:33:27 +0200
Subject: [PATCH] Allow running without template cache set

---
 lib/SimpleSAML/XHTML/Template.php | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php
index bdb444819..3edac5a2d 100644
--- a/lib/SimpleSAML/XHTML/Template.php
+++ b/lib/SimpleSAML/XHTML/Template.php
@@ -126,14 +126,18 @@ class SimpleSAML_XHTML_Template
      */
     private function setupTwig()
     {
-        $cache = $this->configuration->getString('template.cache', $this->configuration->resolvePath('cache'));
-        // set up template paths if template exists
+        $auto_reload = $this->configuration->getBoolean('template.auto_reload', true);
+        $cache = false;
+        if (!$auto_reload) {
+            // Cache only used if auto_reload = false
+            $cache = $this->configuration->getString('template.cache', $this->configuration->resolvePath('cache'));
+        }
+        // set up template paths
         $loader = $this->setupTwigTemplatepaths();
         if (!$loader) {
             return null;
         }
 
-        $auto_reload = $this->configuration->getBoolean('template.auto_reload', false);
         return new \Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => $auto_reload));
     }
 
-- 
GitLab