mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 19:36:43 +00:00
Fixed error guessing for nested templates
This commit is contained in:
@@ -255,7 +255,14 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
|
||||
return $this->env->loadTemplate($template, $index);
|
||||
} catch (Twig_Error $e) {
|
||||
$e->setTemplateFile($templateName ? $templateName : $this->getTemplateName());
|
||||
if (!$e->getTemplateFile()) {
|
||||
$e->setTemplateFile($templateName ? $templateName : $this->getTemplateName());
|
||||
}
|
||||
|
||||
if ($e->getTemplateLine()) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if (!$line) {
|
||||
$e->guess();
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Exception for syntax error in reused template
|
||||
--TEMPLATE--
|
||||
{% use 'foo.twig' %}
|
||||
--TEMPLATE(foo.twig)--
|
||||
{% block bar %}
|
||||
{% do node.data = 5 %}
|
||||
{% endblock %}
|
||||
--EXCEPTION--
|
||||
Twig_Error_Syntax: Unexpected token "operator" of value "=" ("end of statement block" expected) in "foo.twig" at line 3
|
||||
Reference in New Issue
Block a user