Skip to content

Commit ea17f9a

Browse files
committed
MAGETWO-99387: Prohibit usage of native htmlspecialchars()
1 parent 8c978ca commit ea17f9a

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php

+1
Original file line numberDiff line numberDiff line change
@@ -218,5 +218,6 @@ class DiscouragedFunctionSniff extends ForbiddenFunctionsSniff
218218
'^is_null$' => 'strict comparison "=== null"',
219219
'^intval$' => '(int) construction',
220220
'^strval$' => '(string) construction',
221+
'^htmlspecialchars$' => '\Magento\Framework\Escaper->escapeHtml',
221222
];
222223
}

Magento2/Tests/Functions/DiscouragedFunctionUnitTest.inc

+2
Original file line numberDiff line numberDiff line change
@@ -462,3 +462,5 @@ $int = intval($int);
462462
$str = chop($text, 'ttt');
463463

464464
md5($text);
465+
466+
htmlspecialchars('text');

Magento2/Tests/Functions/DiscouragedFunctionUnitTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ public function getWarningList()
249249
458 => 1,
250250
460 => 1,
251251
462 => 1,
252+
466 => 1
252253
];
253254
}
254255
}

0 commit comments

Comments
 (0)