From: Fabien Potencier Date: Fri, 17 May 2013 10:06:31 +0000 (+0200) Subject: fixed the include function when used in an assignment (closes #1095) X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=ba88c75557;p=web%2Fkonrad%2Ftwig.git fixed the include function when used in an assignment (closes #1095) --- diff --git a/CHANGELOG b/CHANGELOG index 4696b40..d0dfeb4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,6 @@ * 1.13.1 (2013-XX-XX) - * n/a + * fixed the include function when used in an assignment * 1.13.0 (2013-05-10) diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index c3ca51a..2c2a96a 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -1295,7 +1295,7 @@ function twig_include(Twig_Environment $env, $context, $template, $variables = a } try { - return $env->resolveTemplate($template)->display($variables); + return $env->resolveTemplate($template)->render($variables); } catch (Twig_Error_Loader $e) { if (!$ignoreMissing) { throw $e; diff --git a/test/Twig/Tests/Fixtures/functions/include/assignment.test b/test/Twig/Tests/Fixtures/functions/include/assignment.test new file mode 100644 index 0000000..b7653b4 --- /dev/null +++ b/test/Twig/Tests/Fixtures/functions/include/assignment.test @@ -0,0 +1,13 @@ +--TEST-- +"include" function +--TEMPLATE-- +{% set tmp = include("foo.twig") %} + +FOO{{ tmp }}BAR +--TEMPLATE(foo.twig)-- +FOOBAR +--DATA-- +return array() +--EXPECT-- +FOO +FOOBARBAR