ensured that the use TokenParser returns a node instance

This commit is contained in:
Fabien Potencier
2017-08-16 08:11:17 +02:00
parent 96f1a5b486
commit 421d8722f0
3 changed files with 27 additions and 0 deletions
+1
View File
@@ -1,5 +1,6 @@
* 1.35.0 (2017-XX-XX)
* fixed use TokenParser to return an empty Node
* added RuntimeExtensionInterface
* added circular reference detection when loading templates
+2
View File
@@ -57,6 +57,8 @@ class Twig_TokenParser_Use extends Twig_TokenParser
$stream->expect(Twig_Token::BLOCK_END_TYPE);
$this->parser->addTrait(new Twig_Node(array('template' => $template, 'targets' => new Twig_Node($targets))));
return new Twig_Node();
}
public function getTag()
@@ -0,0 +1,24 @@
--TEST--
"use" tag with a parent block
--TEMPLATE--
{% extends "parent.twig" %}
{% use 'blocks.twig' %}
{% block body %}
{{ parent() -}}
CHILD
{{ block('content') }}
{% endblock %}
--TEMPLATE(parent.twig)--
{% block body %}
PARENT
{% endblock %}
--TEMPLATE(blocks.twig)--
{% block content 'BLOCK' %}
--DATA--
return array()
--EXPECT--
PARENT
CHILD
BLOCK