Call clearstatcache() before calling is_dir().

This commit is contained in:
Shigeki Morimoto
2016-11-18 16:07:05 +09:00
committed by Fabien Potencier
parent 5040e38885
commit 96638c0da6
+5 -2
View File
@@ -49,8 +49,11 @@ class Twig_Cache_Filesystem implements Twig_CacheInterface
{
$dir = dirname($key);
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(true, $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));