mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 20:06:31 +00:00
Made the include function safe for the autoescaping
This fixes a regression introduced in ba88c75557
Fixes #1097
This commit is contained in:
@@ -191,7 +191,7 @@ class Twig_Extension_Core extends Twig_Extension
|
|||||||
new Twig_SimpleFunction('cycle', 'twig_cycle'),
|
new Twig_SimpleFunction('cycle', 'twig_cycle'),
|
||||||
new Twig_SimpleFunction('random', 'twig_random', array('needs_environment' => true)),
|
new Twig_SimpleFunction('random', 'twig_random', array('needs_environment' => true)),
|
||||||
new Twig_SimpleFunction('date', 'twig_date_converter', array('needs_environment' => true)),
|
new Twig_SimpleFunction('date', 'twig_date_converter', array('needs_environment' => true)),
|
||||||
new Twig_SimpleFunction('include', 'twig_include', array('needs_environment' => true, 'needs_context' => true)),
|
new Twig_SimpleFunction('include', 'twig_include', array('needs_environment' => true, 'needs_context' => true, 'is_safe' => array('all'))),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1273,11 +1273,11 @@ function twig_test_iterable($value)
|
|||||||
/**
|
/**
|
||||||
* Renders a template.
|
* Renders a template.
|
||||||
*
|
*
|
||||||
* @param string template The template to render
|
* @param string $template The template to render
|
||||||
* @param array variables The variables to pass to the template
|
* @param array $variables The variables to pass to the template
|
||||||
* @param Boolean with_context Whether to pass the current context variables or not
|
* @param Boolean $with_context Whether to pass the current context variables or not
|
||||||
* @param Boolean ignore_missing Whether to ignore missing templates or not
|
* @param Boolean $ignore_missing Whether to ignore missing templates or not
|
||||||
* @param Boolean sandboxed Whether to sandbox the template or not
|
* @param Boolean $sandboxed Whether to sandbox the template or not
|
||||||
*
|
*
|
||||||
* @return string The rendered template
|
* @return string The rendered template
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
--TEST--
|
||||||
|
"include" function is safe for auto-escaping
|
||||||
|
--TEMPLATE--
|
||||||
|
{{ include("foo.twig") }}
|
||||||
|
--TEMPLATE(foo.twig)--
|
||||||
|
<p>Test</p>
|
||||||
|
--DATA--
|
||||||
|
return array()
|
||||||
|
--EXPECT--
|
||||||
|
<p>Test</p>
|
||||||
Reference in New Issue
Block a user