Skip to content

Commit

Permalink
Improve compatibility for array operands (#190)
Browse files Browse the repository at this point in the history
Fix #189
  • Loading branch information
live627 authored Mar 11, 2023
1 parent d9c1629 commit 345ff54
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Liquid/AbstractBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ protected function renderAll(array $list, Context $context)
}

if (is_array($value)) {
$value = htmlspecialchars(print_r($value, true));
$value = htmlspecialchars(implode($value));
}

$result .= $value;
Expand Down
3 changes: 1 addition & 2 deletions tests/Liquid/Tag/TagIncludeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ public function testIncludePassArrayWithoutIndex()
$template->parse("{% include 'example' %}");

$output = $template->render(array("var" => array("a", "b", "c")));
$expectedOutput = htmlspecialchars(print_r(array("a", "b", "c"), true));
$this->assertEquals("([$expectedOutput])", $output);
$this->assertEquals("([abc])", $output);
}

public function testIncludePassArrayWithIndex()
Expand Down

0 comments on commit 345ff54

Please sign in to comment.