fix escapement of special chars in key values of debug console

This commit is contained in:
mohrt
2003-04-21 16:17:26 +00:00
parent 97e6b40b81
commit 1f0f8d062c
2 changed files with 6 additions and 2 deletions

2
NEWS
View File

@@ -1,3 +1,5 @@
- fix escapement of special chars for key vals in debug
console (Monte)
- fixed debug timing logic for config_load (Tom Sommer, Monte)
- all in-code doc comments converted to phpDocumentor format (Greg)
- moved strip from smarty core to plugin (Monte)

View File

@@ -21,11 +21,13 @@
*/
function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
{
$_search = array("!\n!", "!\r!", "!\t!");
$_replace = array('<i>&#92;n</i>', '<i>&#92;r</i>', '<i>&#92;t</i>');
if (is_array($var)) {
$results = "<b>Array (".count($var).")</b>";
foreach ($var as $curr_key => $curr_val) {
$return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length);
$results .= '<br>\r'.str_repeat('&nbsp;', $depth*2)."<b>$curr_key</b> =&gt; $return";
$results .= '<br>\r'.str_repeat('&nbsp;', $depth*2)."<b>".preg_replace($_search, $_replace, $curr_key)."</b> =&gt; $return";
}
return $results;
} else if (is_object($var)) {
@@ -45,7 +47,7 @@ function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
} else {
$results = $var;
}
$results = preg_replace("![\r\t\n]!", " ", $results);
$results = preg_replace($_search, $_replace, $results);
$results = htmlspecialchars($results);
return $results;
}