Fixed: Endless loop if more than one parent without the macro exists

This commit is contained in:
Savas Ziplies
2019-06-03 15:21:43 +02:00
committed by Fabien Potencier
parent 0840c7902b
commit 4497083325
+2 -1
View File
@@ -1083,7 +1083,8 @@ function twig_capitalize_string_filter(Environment $env, $string)
function twig_call_macro(Template $template, string $method, array $args, int $lineno, array $context, Source $source)
{
if (!method_exists($template, $method)) {
while ($parent = $template->getParent($context)) {
$parent = $template;
while ($parent = $parent->getParent($context)) {
if (method_exists($parent, $method)) {
return $parent->$method(...$args);
}