* 0.9.2-DEV
+ * avoid writing template file if an error occurs
* added $ escaping when outputting raw strings
* enhanced some error messages to ease debugging
* fixed empty cache files when the template contains an error
$cache = $this->getCacheFilename($name);
if (!file_exists($cache) || false === $mtime || ($this->autoReload && (filemtime($cache) < $mtime)))
{
+ // compile first to avoid empty files when an Exception occurs
+ $content = $this->compile($template, $name);
+
$fp = @fopen($cache, 'wb');
if (!$fp)
{
- $this->evalString($template, $name);
+ eval('?>'.$content);
return $cls;
}
-
- // compile first to avoid empty files when an Exception occurs
- $content = $this->compile($template, $name);
+ fclose($fp);
file_put_contents($cache, $content);
- fclose($fp);
}
require_once $cache;