diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c134c13..4395a309 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [4.5.5] - 2024-11-21 +- Fixed escaping of array/object keys in debug_print_var +## [4.5.5] - 2024-11-21 - Support the deprecations introduced in PHP 8.4 and added tests for PHP 8.4 [#1084](https://github.com/smarty-php/smarty/pull/1084) diff --git a/libs/plugins/modifier.debug_print_var.php b/libs/plugins/modifier.debug_print_var.php index 78397d01..1a3ff0de 100644 --- a/libs/plugins/modifier.debug_print_var.php +++ b/libs/plugins/modifier.debug_print_var.php @@ -31,7 +31,7 @@ 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) . + $results .= '
' . str_repeat(' ', $depth * 2) . '' . htmlspecialchars(strtr($curr_key, $_replace)) . ' => ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects); $depth--; @@ -49,7 +49,7 @@ 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) . + $results .= '
' . str_repeat(' ', $depth * 2) . ' ->' . htmlspecialchars(strtr($curr_key, $_replace)) . ' = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects); $depth--; }