blob: 0927bd44c08506a7aa4acf07c74391eca127806f (
plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
--TEST--
Test get_html_translation_table() function : basic functionality - table as HTML_SPECIALCHARS
--FILE--
<?php
/* test get_html_translation_table() when $table argument is specified as HTML_SPECIALCHARS */
echo "*** Testing get_html_translation_table() : basic functionality ***\n";
// $table as HTML_SEPCIALCHARS and different quote style
echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --\n";
$table = HTML_SPECIALCHARS;
$quote_style = ENT_COMPAT;
$tt = get_html_translation_table($table, $quote_style, "UTF-8");
asort( $tt );
var_dump( $tt );
echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES --\n";
$quote_style = ENT_QUOTES;
$tt = get_html_translation_table($table, $quote_style, "UTF-8");
asort( $tt );
var_dump( $tt );
echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES --\n";
$quote_style = ENT_NOQUOTES;
$tt = get_html_translation_table($table, $quote_style, "UTF-8");
asort( $tt );
var_dump( $tt );
echo "Done\n";
?>
--EXPECT--
*** Testing get_html_translation_table() : basic functionality ***
-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --
array(4) {
["&"]=>
string(5) "&"
[">"]=>
string(4) ">"
["<"]=>
string(4) "<"
["""]=>
string(6) """
}
-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES --
array(5) {
["'"]=>
string(6) "'"
["&"]=>
string(5) "&"
[">"]=>
string(4) ">"
["<"]=>
string(4) "<"
["""]=>
string(6) """
}
-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES --
array(3) {
["&"]=>
string(5) "&"
[">"]=>
string(4) ">"
["<"]=>
string(4) "<"
}
Done
|