mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-02 01:47:10 +00:00
Merge branch '1.x' into 2.x
* 1.x: fixed batch filter clobbers array keys when fill parameter is used added preserveKeys support for the batch filter removed dead code fixed "embed" support when used from "template_from_string" fixed CS
This commit is contained in:
+12
-4
@@ -299,7 +299,7 @@ class Environment
|
||||
{
|
||||
$key = $this->getLoader()->getCacheKey($name).$this->optionsHash;
|
||||
|
||||
return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '_'.$index);
|
||||
return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '___'.$index);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -379,9 +379,17 @@ class Environment
|
||||
*/
|
||||
public function loadTemplate($name, $index = null)
|
||||
{
|
||||
$cls = $mainCls = $this->getTemplateClass($name);
|
||||
return $this->loadClass($this->getTemplateClass($name), $name, $index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function loadClass($cls, $name, $index = null)
|
||||
{
|
||||
$mainCls = $cls;
|
||||
if (null !== $index) {
|
||||
$cls .= '_'.$index;
|
||||
$cls .= '___'.$index;
|
||||
}
|
||||
|
||||
if (isset($this->loadedTemplates[$cls])) {
|
||||
@@ -411,7 +419,7 @@ class Environment
|
||||
}
|
||||
|
||||
if (!class_exists($cls, false)) {
|
||||
throw new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache is corrupted.', $name, $index), -1, $source);
|
||||
throw new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user