mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-24 23:16:26 +00:00
Fix template name in error for an unknown dynamic extends called from an include
This commit is contained in:
+8
-15
@@ -80,23 +80,16 @@ abstract class Template
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!$parent = $this->doGetParent($context)) {
|
||||
return false;
|
||||
}
|
||||
if (!$parent = $this->doGetParent($context)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($parent instanceof self || $parent instanceof TemplateWrapper) {
|
||||
return $this->parents[$parent->getSourceContext()->getName()] = $parent;
|
||||
}
|
||||
if ($parent instanceof self || $parent instanceof TemplateWrapper) {
|
||||
return $this->parents[$parent->getSourceContext()->getName()] = $parent;
|
||||
}
|
||||
|
||||
if (!isset($this->parents[$parent])) {
|
||||
$this->parents[$parent] = $this->loadTemplate($parent);
|
||||
}
|
||||
} catch (LoaderError $e) {
|
||||
$e->setSourceContext(null);
|
||||
$e->guess();
|
||||
|
||||
throw $e;
|
||||
if (!isset($this->parents[$parent])) {
|
||||
$this->parents[$parent] = $this->loadTemplate($parent);
|
||||
}
|
||||
|
||||
return $this->parents[$parent];
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
"extends" tag
|
||||
--TEMPLATE--
|
||||
{{ include('included.twig') }}
|
||||
|
||||
--TEMPLATE(included.twig)--
|
||||
|
||||
|
||||
|
||||
{% extends dynamic %}
|
||||
--DATA--
|
||||
return ['dynamic' => 'unknown.twig']
|
||||
--EXCEPTION--
|
||||
Twig\Error\LoaderError: Template "unknown.twig" is not defined in "included.twig" at line 5.
|
||||
Reference in New Issue
Block a user