From: Fabien Potencier Date: Tue, 8 May 2012 12:24:57 +0000 (+0200) Subject: fixed dump function is_safe value when html_errors is not defined in php.ini (closes... X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=078905ed9507808b260d34fd8928e79e3a600d1d;p=web%2Fkonrad%2Ftwig.git fixed dump function is_safe value when html_errors is not defined in php.ini (closes #720) --- diff --git a/lib/Twig/Extension/Debug.php b/lib/Twig/Extension/Debug.php index aab7093..8059df0 100644 --- a/lib/Twig/Extension/Debug.php +++ b/lib/Twig/Extension/Debug.php @@ -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)),