From f86f551ef18d673760c985f49f5ffdbfcdb1b7c2 Mon Sep 17 00:00:00 2001 From: Philo Hermans Date: Fri, 22 Dec 2023 21:46:25 +0100 Subject: [PATCH] Update AbstractBlock.php --- src/Liquid/AbstractBlock.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Liquid/AbstractBlock.php b/src/Liquid/AbstractBlock.php index 6e0820b2..abd80a97 100644 --- a/src/Liquid/AbstractBlock.php +++ b/src/Liquid/AbstractBlock.php @@ -164,7 +164,7 @@ protected function renderAll(array $list, Context $context) } if (is_array($value)) { - $value = htmlspecialchars(implode($value)); + $value = $this->arrayToString($value); } $result .= $value; @@ -181,6 +181,21 @@ protected function renderAll(array $list, Context $context) return $result; } + + protected function arrayToString($value) + { + $result = []; + + foreach ($value as $item) { + if (is_array($item)) { + $result[] = $this->arrayToString($item); + } else { + $result[] = htmlspecialchars($item); + } + } + + return implode(', ', $result); + } /** * An action to execute when the end tag is reached