Skip to content

Commit

Permalink
Filters: compatibility with JS binding II.
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Oct 2, 2021
1 parent e11912d commit 53e5da9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Latte/Runtime/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function escapeHtmlText($s): string
return $s->__toString(true);
}
$s = htmlspecialchars((string) $s, ENT_NOQUOTES | ENT_SUBSTITUTE, 'UTF-8');
$s = str_replace('{{', '{<!-- -->{', $s);
$s = strtr($s, ['{{' => '{<!-- -->{', '{' => '&#123;']);
return $s;
}

Expand All @@ -64,7 +64,9 @@ public static function escapeHtmlAttr($s, bool $double = true): string
if (strpos($s, '`') !== false && strpbrk($s, ' <>"\'') === false) {
$s .= ' '; // protection against innerHTML mXSS vulnerability nette/nette#1496
}
return htmlspecialchars($s, ENT_QUOTES | ENT_HTML5 | ENT_SUBSTITUTE, 'UTF-8', $double);
$s = htmlspecialchars($s, ENT_QUOTES | ENT_HTML5 | ENT_SUBSTITUTE, 'UTF-8', $double);
$s = str_replace('{', '&#123;', $s);
return $s;
}


Expand Down

0 comments on commit 53e5da9

Please sign in to comment.