Skip to content

Commit

Permalink
Fixed: Endless loop if more than one parent without the macro exists
Browse files Browse the repository at this point in the history
  • Loading branch information
nea authored and fabpot committed Jun 3, 2019
1 parent 0840c79 commit 4497083
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Extension/CoreExtension.php
Expand Up @@ -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);
}
Expand Down

0 comments on commit 4497083

Please sign in to comment.