replace file_exists() by is_file() as this is semantically more correct (we don't want dirs to match)

This commit is contained in:
Fabien Potencier
2011-08-27 09:56:45 +02:00
parent 46c258d29d
commit 4c1b45204b
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ class Twig_Autoloader
return;
}
if (file_exists($file = dirname(__FILE__).'/../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php')) {
if (is_file($file = dirname(__FILE__).'/../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php')) {
require $file;
}
}
+1 -1
View File
@@ -301,7 +301,7 @@ class Twig_Environment
if (false === $cache = $this->getCacheFilename($name)) {
eval('?>'.$this->compileSource($this->loader->getSource($name), $name));
} else {
if (!file_exists($cache) || ($this->isAutoReload() && !$this->loader->isFresh($name, filemtime($cache)))) {
if (!is_file($cache) || ($this->isAutoReload() && !$this->loader->isFresh($name, filemtime($cache)))) {
$this->writeCacheFile($cache, $this->compileSource($this->loader->getSource($name), $name));
}
+1 -1
View File
@@ -161,7 +161,7 @@ class Twig_Error extends Exception
continue;
}
if (!file_exists($r->getFilename())) {
if (!is_file($r->getFilename())) {
// probably an eval()'d code
return array($currentLine, $currentFile);
}