Skip to content

Commit 53e5da9

Browse files
committed
Filters: compatibility with JS binding II.
1 parent e11912d commit 53e5da9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Latte/Runtime/Filters.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function escapeHtmlText($s): string
4848
return $s->__toString(true);
4949
}
5050
$s = htmlspecialchars((string) $s, ENT_NOQUOTES | ENT_SUBSTITUTE, 'UTF-8');
51-
$s = str_replace('{{', '{<!-- -->{', $s);
51+
$s = strtr($s, ['{{' => '{<!-- -->{', '{' => '&#123;']);
5252
return $s;
5353
}
5454

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

7072

0 commit comments

Comments
 (0)