Merge branch '2.x' into 3.x

* 2.x:
  simplified code
  fixed a PHP fatal error when calling a macro, imported in the template, in another macro
This commit is contained in:
Fabien Potencier
2019-05-16 14:16:52 +02:00
3 changed files with 17 additions and 5 deletions
+1
View File
@@ -250,6 +250,7 @@
* 1.41.1 (2019-XX-XX)
* fixed a PHP fatal error when calling a macro imported in the template in another macro
* fixed wrong error message on "import" and "from"
* 1.41.0 (2019-05-14)
+1 -5
View File
@@ -266,11 +266,7 @@ class Parser
public function getImportedSymbol(string $type, string $alias)
{
foreach ($this->importedSymbols as $functions) {
if (isset($functions[$type][$alias])) {
return $functions[$type][$alias];
}
}
return $this->importedSymbols[0][$type][$alias] ?? null;
}
public function isMainScope(): bool
@@ -0,0 +1,15 @@
--TEST--
"from" tag with syntax error
--TEMPLATE--
{% from _self import another %}
{% macro foo() %}
{{ another() }}
{% endmacro %}
{% macro another() %}
{% endmacro %}
--DATA--
return []
--EXCEPTION--
Twig\Error\SyntaxError: Unknown "another" function in "index.twig" at line 5.