public function getFunctions()
{
// dump is safe if var_dump is overriden by xdebug
- $isDumpOutputHtmlSafe = extension_loaded('xdebug') && (false === get_cfg_var('xdebug.overload_var_dump') || get_cfg_var('xdebug.overload_var_dump')) && get_cfg_var('html_errors');
+ $isDumpOutputHtmlSafe = extension_loaded('xdebug')
+ // false means that it was not set (and the default is on) or it explicitly enabled
+ && (false === ini_get('xdebug.overload_var_dump') || ini_get('xdebug.overload_var_dump'))
+ // false means that it was not set (and the default is on) or it explicitly enabled
+ // xdebug.overload_var_dump produces HTML only when html_errors is also enabled
+ && (false === ini_get('html_errors') || ini_get('html_errors'))
+ ;
return array(
'dump' => new Twig_Function_Function('twig_var_dump', array('is_safe' => $isDumpOutputHtmlSafe ? array('html') : array(), 'needs_context' => true, 'needs_environment' => true)),