changed template cache names to take into account the Twig C extension

This commit is contained in:
Fabien Potencier
2015-09-21 09:20:31 +02:00
parent f0b5b8ce8e
commit 76ecd43338
2 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
* 1.22.3 (2015-XX-XX)
* n/a
* changed template cache names to take into account the Twig C extension
* 1.22.2 (2015-09-22)
+10
View File
@@ -291,6 +291,12 @@ class Twig_Environment
/**
* Gets the template class associated with the given string.
*
* The generated template class is based on the following parameters:
*
* * The cache key for the given template;
* * The currently enabled extensions;
* * Whether the Twig C extension is available or not.
*
* @param string $name The name for which to calculate the template class name
* @param int $index The index if it is an embedded template
*
@@ -300,6 +306,10 @@ class Twig_Environment
{
$key = $this->getLoader()->getCacheKey($name).'__'.implode('__', array_keys($this->extensions));
if (function_exists('twig_template_get_attributes')) {
$key .= '__cext';
}
return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '_'.$index);
}