Skip to content

Commit fa95063

Browse files
author
Oleksandr Iegorov
committed
MAGETWO-97040: Magento Framework Escaper - Critical log with special symbols
1 parent 847d20f commit fa95063

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/internal/Magento/Framework/Test/Unit/EscaperTest.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ public function testEscapeJsEscapesOwaspRecommendedRanges()
6969
// Exceptions to escaping ranges
7070
$immune = [',', '.', '_'];
7171
for ($chr = 0; $chr < 0xFF; $chr++) {
72-
if ($chr >= 0x30 && $chr <= 0x39
73-
|| $chr >= 0x41 && $chr <= 0x5A
74-
|| $chr >= 0x61 && $chr <= 0x7A
72+
if (($chr >= 0x30 && $chr <= 0x39)
73+
|| ($chr >= 0x41 && $chr <= 0x5A)
74+
|| ($chr >= 0x61 && $chr <= 0x7A)
7575
) {
7676
$literal = $this->codepointToUtf8($chr);
7777
$this->assertEquals($literal, $this->escaper->escapeJs($literal));
@@ -171,6 +171,11 @@ public function escapeHtmlDataProvider()
171171
'data' => '&<>"\'&amp;&lt;&gt;&quot;&#039;&#9;',
172172
'expected' => '&amp;&lt;&gt;&quot;&#039;&amp;&lt;&gt;&quot;&#039;&#9;'
173173
],
174+
'text with special characters and allowed tag' => [
175+
'data' => '&<br/>"\'&amp;&lt;&gt;&quot;&#039;&#9;',
176+
'expected' => '&amp;<br>&quot;&#039;&amp;&lt;&gt;&quot;&#039;&#9;',
177+
'allowedTags' => ['br'],
178+
],
174179
'text with multiple allowed tags, includes self closing tag' => [
175180
'data' => '<span>some text in tags<br /></span>',
176181
'expected' => '<span>some text in tags<br></span>',

0 commit comments

Comments
 (0)