mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 04:16:28 +00:00
bug #1583 The results of is_dir() are cached (THofman)
This PR was merged into the 1.16-dev branch.
Discussion
----------
The results of is_dir() are cached
If a production server uses statcache, the results of the first and second call of is_dir() is always the same.
So before calling is_dir() for the second time, use clearstatcache() to clear the results of the first call of is_dir().
Commits
-------
df0d813 The results of is_dir() are cached
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user