From 057380694c34de7a46e65c2c06ece30504c7f510 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 7 Nov 2010 14:31:47 +0100 Subject: [PATCH] fixed child templates (with an extend tag) that uses one or more imports --- CHANGELOG | 1 + lib/Twig/Parser.php | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1fa01e1..fe2b37d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -12,6 +12,7 @@ Backward incompatibilities: * the include tag now merges the passed variables with the current context by default (the old behavior is still possible by adding the "only" keyword) + * fixed child templates (with an extend tag) that uses one or more imports * added support for {{ 1 not in [2, 3] }} (more readable than the current {{ not (1 in [2, 3]) }}) * escaping has been rewritten (from pre-escaping to post-escaping) * the implementation of template inheritance has been rewritten diff --git a/lib/Twig/Parser.php b/lib/Twig/Parser.php index ab75288..dfe8242 100644 --- a/lib/Twig/Parser.php +++ b/lib/Twig/Parser.php @@ -218,7 +218,7 @@ class Twig_Parser implements Twig_ParserInterface if ( ($node instanceof Twig_Node_Text && !preg_match('/^\s*$/s', $node->getAttribute('data'))) || - (!$node instanceof Twig_Node_Text && !$node instanceof Twig_Node_BlockReference) + (!$node instanceof Twig_Node_Text && !$node instanceof Twig_Node_BlockReference && !$node instanceof Twig_Node_Import) ) { throw new Twig_SyntaxError('A template that extends another one cannot have a body', $node->getLine(), $this->stream->getFilename()); } -- 1.7.2.5