From 4c1b45204baaba9c46549a4bb63f077113b35b5e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 27 Aug 2011 09:56:45 +0200 Subject: [PATCH] replace file_exists() by is_file() as this is semantically more correct (we don't want dirs to match) --- lib/Twig/Autoloader.php | 2 +- lib/Twig/Environment.php | 2 +- lib/Twig/Error.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Twig/Autoloader.php b/lib/Twig/Autoloader.php index ba43e14..a93b8ca 100644 --- a/lib/Twig/Autoloader.php +++ b/lib/Twig/Autoloader.php @@ -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; } } diff --git a/lib/Twig/Environment.php b/lib/Twig/Environment.php index d706f6c..5c302f3 100644 --- a/lib/Twig/Environment.php +++ b/lib/Twig/Environment.php @@ -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)); } diff --git a/lib/Twig/Error.php b/lib/Twig/Error.php index d05d83c..d6946f0 100644 --- a/lib/Twig/Error.php +++ b/lib/Twig/Error.php @@ -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); } -- 1.7.2.5