From: Fabien Potencier Date: Sat, 21 Jul 2012 22:07:57 +0000 (+0200) Subject: reverted partially a previous commit X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=14a472b489fef539bea3ce2e31a0db3200127af7;p=web%2Fkonrad%2Ftwig.git 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) --- 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; } /**