diff --git a/src/Node/Expression/CallExpression.php b/src/Node/Expression/CallExpression.php index 5c7326bf4..fd218b007 100644 --- a/src/Node/Expression/CallExpression.php +++ b/src/Node/Expression/CallExpression.php @@ -37,7 +37,7 @@ protected function compileCallable(Compiler $compiler) } else { $compiler->raw(sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1])); } - } elseif (\is_array($callable) && $callable[0] instanceof ExtensionInterface) { + } elseif (\is_array($callable) && $callable[0] instanceof ExtensionInterface && false === strpos($callable[1], 'closure:')) { $class = \get_class($callable[0]); if (!$compiler->getEnvironment()->hasExtension($class)) { // Compile a non-optimized call to trigger a \Twig\Error\RuntimeError, which cannot be a compile-time error