mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 10:26:32 +00:00
fixed block names unicity
This commit is contained in:
+1
-1
@@ -50,7 +50,7 @@ class Twig_Parser implements Twig_ParserInterface
|
||||
|
||||
public function getVarName()
|
||||
{
|
||||
return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->varNameSalt++));
|
||||
return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->stream->getSourceContext()->getCode().$this->varNameSalt++));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Block names are unique per template
|
||||
--TEMPLATE--
|
||||
{% extends 'layout' %}
|
||||
{% block content -%}
|
||||
{% filter title -%}
|
||||
second
|
||||
{% endfilter %}
|
||||
{% endblock %}
|
||||
--TEMPLATE(layout)--
|
||||
{% filter title -%}
|
||||
first
|
||||
{% endfilter %}
|
||||
{% block content %}{% endblock %}
|
||||
--DATA--
|
||||
return array();
|
||||
--EXPECT--
|
||||
First
|
||||
Second
|
||||
Reference in New Issue
Block a user