Do not repeat dirname function execution in writing cache files

This commit is contained in:
glutamatt
2013-10-04 15:40:25 +02:00
parent 96289a088b
commit a9870f4160
+1 -1
View File
@@ -1217,7 +1217,7 @@ class Twig_Environment
throw new RuntimeException(sprintf("Unable to write in the cache directory (%s).", $dir));
}
$tmpFile = tempnam(dirname($file), basename($file));
$tmpFile = tempnam($dir, basename($file));
if (false !== @file_put_contents($tmpFile, $content)) {
// rename does not work on Win32 before 5.2.6
if (@rename($tmpFile, $file) || (@copy($tmpFile, $file) && unlink($tmpFile))) {