From 14a472b489fef539bea3ce2e31a0db3200127af7 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 22 Jul 2012 00:07:57 +0200 Subject: [PATCH] reverted partially a previous commit This code was not only useful for macros but also when you call a method on a template instance -- this is not recommended/supported but used by the Symfony profiler) --- lib/Twig/Template.php | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/lib/Twig/Template.php b/lib/Twig/Template.php index beed5c5..64a08f6 100644 --- a/lib/Twig/Template.php +++ b/lib/Twig/Template.php @@ -422,7 +422,15 @@ abstract class Twig_Template implements Twig_TemplateInterface $this->env->getExtension('sandbox')->checkMethodAllowed($object, $method); } - return call_user_func_array(array($object, $method), $arguments); + $ret = call_user_func_array(array($object, $method), $arguments); + + // useful when calling a template method from a template + // this is not supported but unfortunately heavily used in the Symfony profiler + if ($object instanceof Twig_TemplateInterface) { + return $ret === '' ? '' : new Twig_Markup($ret, $this->env->getCharset()); + } + + return $ret; } /** -- 1.7.2.5