diff --git a/change_log.txt b/change_log.txt
index 9d19c9da..93740fc0 100644
--- a/change_log.txt
+++ b/change_log.txt
@@ -1,4 +1,7 @@
===== 3.1.30-dev ===== (xx.xx.xx)
+ 26.01.2016
+ - improvement observe Smarty::$_CHARSET in debugging console https://github.com/smarty-php/smarty/issues/169
+
02.01.2016
- update scope handling
- optimize block plugin compiler
diff --git a/libs/plugins/modifier.debug_print_var.php b/libs/plugins/modifier.debug_print_var.php
index 4ff8213c..804d743d 100644
--- a/libs/plugins/modifier.debug_print_var.php
+++ b/libs/plugins/modifier.debug_print_var.php
@@ -24,10 +24,7 @@
*/
function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = 0, $objects = array())
{
- $_replace = array("\n" => '\n',
- "\r" => '\r',
- "\t" => '\t'
- );
+ $_replace = array("\n" => '\n', "\r" => '\r', "\t" => '\t');
switch (gettype($var)) {
case 'array' :
$results = 'Array (' . count($var) . ')';
@@ -35,9 +32,8 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
break;
}
foreach ($var as $curr_key => $curr_val) {
- $results .= '
' . str_repeat(' ', $depth * 2)
- . '' . strtr($curr_key, $_replace) . ' => '
- . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
+ $results .= '
' . str_repeat(' ', $depth * 2) . '' . strtr($curr_key, $_replace) .
+ ' => ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
$depth --;
}
break;
@@ -54,9 +50,8 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
}
$objects[] = $var;
foreach ($object_vars as $curr_key => $curr_val) {
- $results .= '
' . str_repeat(' ', $depth * 2)
- . ' ->' . strtr($curr_key, $_replace) . ' = '
- . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
+ $results .= '
' . str_repeat(' ', $depth * 2) . ' ->' . strtr($curr_key, $_replace) .
+ ' = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
$depth --;
}
break;
@@ -88,12 +83,12 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
$results = mb_substr($var, 0, $length - 3, Smarty::$_CHARSET) . '...';
}
} else {
- if (isset($var[$length])) {
+ if (isset($var[ $length ])) {
$results = substr($var, 0, $length - 3) . '...';
}
}
- $results = htmlspecialchars('"' . $results . '"');
+ $results = htmlspecialchars('"' . $results . '"', ENT_QUOTES, Smarty::$_CHARSET);
break;
case 'unknown type' :
@@ -109,7 +104,7 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
}
}
- $results = htmlspecialchars($results);
+ $results = htmlspecialchars($results, ENT_QUOTES, Smarty::$_CHARSET);
}
return $results;