1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
--TEST--
htmlentities() / htmlspecialchars() "don't double encode" flag support
--FILE--
<?php
$tests = array(
"abc",
"abc&sfdsa",
"test+s & some more D",
"test+s & some more D",
"&; & &#a; &9; &#xyz;",
"&kffjadfdhsjfhjasdhffasdfas;",
"�",
"&",
"&&&",
"&ab&&",
);
foreach ($tests as $test) {
var_dump(htmlentities($test, ENT_QUOTES, NULL, FALSE));
var_dump(htmlspecialchars($test, ENT_QUOTES, NULL, FALSE));
}
?>
--EXPECT--
string(3) "abc"
string(3) "abc"
string(13) "abc&sfdsa"
string(13) "abc&sfdsa"
string(33) "test+s & some more D"
string(33) "test+s & some more D"
string(34) "test+s & some more D"
string(34) "test+s & some more D"
string(43) "&; &amp &#a; &9; &#xyz;"
string(43) "&; &amp &#a; &9; &#xyz;"
string(32) "&kffjadfdhsjfhjasdhffasdfas;"
string(32) "&kffjadfdhsjfhjasdhffasdfas;"
string(16) "&#8787978789"
string(16) "&#8787978789"
string(5) "&"
string(5) "&"
string(15) "&&&"
string(15) "&&&"
string(17) "&ab&&"
string(17) "&ab&&"
|