mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-03 22:17:36 +00:00
bug #2262 Call clearstatcache() before calling is_dir(). (hanabokuro)
This PR was submitted for the master branch but it was merged into the 1.x branch instead (closes #2262).
Discussion
----------
Call clearstatcache() before calling is_dir().
The result of is_dir() is cached.
So call clearstatcache() before calling 2nd is_dir().
Commits
-------
96638c0d Call clearstatcache() before calling is_dir().
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user