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)
This commit is contained in:
Fabien Potencier
2012-07-22 00:07:57 +02:00
parent 8832b660b8
commit 14a472b489
+9 -1
View File
@@ -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;
}
/**