Skip to content

Commit

Permalink
return empty string on escape(null)
Browse files Browse the repository at this point in the history
  • Loading branch information
fedeisas committed Oct 4, 2024
1 parent a243192 commit d0f7660
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Liquid/StandardFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public static function escape($input)
}

if (is_null($input)) {
return $input;
return '';
}

return htmlentities($input, ENT_QUOTES);
Expand Down
2 changes: 1 addition & 1 deletion tests/Liquid/StandardFiltersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public function testEscape()
$data = array(
"one Word's not" => "one Word's not",
"&><\"'" => "&amp;&gt;&lt;&quot;&#039;",
null => null,
null => '',
);

foreach ($data as $element => $expected) {
Expand Down

0 comments on commit d0f7660

Please sign in to comment.