mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
fix escapement of special chars in key values of debug console
This commit is contained in:
2
NEWS
2
NEWS
@@ -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)
|
||||
|
@@ -21,11 +21,13 @@
|
||||
*/
|
||||
function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
|
||||
{
|
||||
$_search = array("!\n!", "!\r!", "!\t!");
|
||||
$_replace = array('<i>\n</i>', '<i>\r</i>', '<i>\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(' ', $depth*2)."<b>$curr_key</b> => $return";
|
||||
$results .= '<br>\r'.str_repeat(' ', $depth*2)."<b>".preg_replace($_search, $_replace, $curr_key)."</b> => $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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user