From 4497083325191954609b10c547d1efd8cf4bfcd2 Mon Sep 17 00:00:00 2001 From: Savas Ziplies Date: Mon, 3 Jun 2019 15:21:43 +0200 Subject: [PATCH] Fixed: Endless loop if more than one parent without the macro exists --- src/Extension/CoreExtension.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Extension/CoreExtension.php b/src/Extension/CoreExtension.php index 908246547c..d410c6288e 100644 --- a/src/Extension/CoreExtension.php +++ b/src/Extension/CoreExtension.php @@ -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); }