fixed cache option initialization
authorFabien Potencier <fabien.potencier@gmail.com>
Thu, 6 Jan 2011 07:03:47 +0000 (08:03 +0100)
committerFabien Potencier <fabien.potencier@gmail.com>
Thu, 6 Jan 2011 07:03:47 +0000 (08:03 +0100)
lib/Twig/Environment.php

index 3a5c034..48af99a 100644 (file)
@@ -103,9 +103,7 @@ class Twig_Environment
         );
         $this->strictVariables    = (bool) $options['strict_variables'];
         $this->runtimeInitialized = false;
-        if ($options['cache']) {
-            $this->setCache($options['cache']);
-        }
+        $this->setCache($options['cache']);
     }
 
     /**
@@ -224,11 +222,11 @@ class Twig_Environment
       */
     public function setCache($cache)
     {
-        $this->cache = $cache;
-
-        if ($this->cache && !is_dir($this->cache)) {
-            mkdir($this->cache, 0777, true);
+        if (!$this->cache) {
+            $this->cache = false;
         }
+
+        $this->cache = $cache;
     }
 
     /**