The results of is_dir() are cached

So before calling is_dir() for the second time, clearstatcache of the dir
This commit is contained in:
THofman
2014-12-23 11:44:06 +01:00
parent a1b847b3a3
commit df0d813a06
+5 -2
View File
@@ -1232,8 +1232,11 @@ class Twig_Environment
{
$dir = dirname($file);
if (!is_dir($dir)) {
if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
throw new RuntimeException(sprintf("Unable to create the cache directory (%s).", $dir));
if (false === @mkdir($dir, 0777, true)) {
clearstatcache(false, $dir);
if (!is_dir($dir)) {
throw new RuntimeException(sprintf("Unable to create the cache directory (%s).", $dir));
}
}
} elseif (!is_writable($dir)) {
throw new RuntimeException(sprintf("Unable to write in the cache directory (%s).", $dir));