mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-18 05:16:30 +00:00
fixed dump function is_safe value when html_errors is not defined in php.ini (closes #720)
This commit is contained in:
@@ -18,7 +18,13 @@ class Twig_Extension_Debug extends Twig_Extension
|
||||
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)),
|
||||
|
||||
Reference in New Issue
Block a user