Annotation of embedaddon/php/ext/standard/tests/strings/htmlentities23.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: htmlentities() / htmlspecialchars() ENT_SUBSTITUTE EUC-JP
3: --FILE--
4: <?php
5: $tests = array(
6: "\x8F\xA1\xFF", //2 sub as 2nd is potentially valid as lead
7: "\x8F\xA1", //2 sub, as 2nd is potentially valid as lead
8: "\x8F", //1 sub
9: "\x8F\xA0", //1 sub, A0 is not valid as sole/first byte
10: "\x8F\xA1\x21", //2 sub, no consume last
11: "\x8F\x21", //1 sub, no consume last
12: "\x8E\xAE", //valid
13: "\x8E", //1 sub
14: "\x8E\x21", //1 sub, no consume last
15: "\xB2\xFF", //1 sub
16: "\xB2", //1 sub
17: "\xB2\x21", //1 sub, no consume last
18: "\xA0", //1 sub
19: );
20:
21: foreach ($tests as $test) {
22: error_reporting(~E_STRICT);
23: $a = htmlentities($test, ENT_QUOTES | ENT_SUBSTITUTE, "EUC-JP");
24: error_reporting(-1);
25: var_dump($a, bin2hex($a));
26: $a = htmlspecialchars($test, ENT_QUOTES | ENT_SUBSTITUTE, "EUC-JP");
27: var_dump($a, bin2hex($a));
28: echo "\n";
29: }
30: ?>
31: --EXPECT--
32: string(16) "��"
33: string(32) "262378464646443b262378464646443b"
34: string(16) "��"
35: string(32) "262378464646443b262378464646443b"
36:
37: string(16) "��"
38: string(32) "262378464646443b262378464646443b"
39: string(16) "��"
40: string(32) "262378464646443b262378464646443b"
41:
42: string(8) "�"
43: string(16) "262378464646443b"
44: string(8) "�"
45: string(16) "262378464646443b"
46:
47: string(8) "�"
48: string(16) "262378464646443b"
49: string(8) "�"
50: string(16) "262378464646443b"
51:
52: string(17) "��!"
53: string(34) "262378464646443b262378464646443b21"
54: string(17) "��!"
55: string(34) "262378464646443b262378464646443b21"
56:
57: string(9) "�!"
58: string(18) "262378464646443b21"
59: string(9) "�!"
60: string(18) "262378464646443b21"
61:
62: string(2) "Ž®"
63: string(4) "8eae"
64: string(2) "Ž®"
65: string(4) "8eae"
66:
67: string(8) "�"
68: string(16) "262378464646443b"
69: string(8) "�"
70: string(16) "262378464646443b"
71:
72: string(9) "�!"
73: string(18) "262378464646443b21"
74: string(9) "�!"
75: string(18) "262378464646443b21"
76:
77: string(8) "�"
78: string(16) "262378464646443b"
79: string(8) "�"
80: string(16) "262378464646443b"
81:
82: string(8) "�"
83: string(16) "262378464646443b"
84: string(8) "�"
85: string(16) "262378464646443b"
86:
87: string(9) "�!"
88: string(18) "262378464646443b21"
89: string(9) "�!"
90: string(18) "262378464646443b21"
91:
92: string(8) "�"
93: string(16) "262378464646443b"
94: string(8) "�"
95: string(16) "262378464646443b"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>