1--TEST--
2Test get_html_translation_table() function : basic functionality - XHTML 1.0
3--FILE--
4<?php
5echo "*** Testing get_html_translation_table() : basic functionality/XHTML 1.0 ***\n";
6
7echo "-- with table = HTML_ENTITIES, ENT_QUOTES --\n";
8$table = HTML_ENTITIES;
9/* uses &#039; to share the code path with HTML 4.01 */
10$tt = get_html_translation_table($table, ENT_QUOTES | ENT_XHTML, "UTF-8");
11asort( $tt );
12var_dump( count($tt) );
13print_r( $tt );
14
15echo "-- with table = HTML_ENTITIES, ENT_COMPAT --\n";
16$table = HTML_ENTITIES;
17$tt = get_html_translation_table($table, ENT_COMPAT | ENT_XHTML, "UTF-8");
18var_dump( count($tt) );
19
20echo "-- with table = HTML_ENTITIES, ENT_NOQUOTES --\n";
21$table = HTML_ENTITIES;
22$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_XHTML, "UTF-8");
23var_dump( count($tt) );
24
25echo "-- with table = HTML_SPECIALCHARS, ENT_COMPAT --\n";
26$table = HTML_SPECIALCHARS;
27$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
28asort( $tt );
29var_dump( count($tt) );
30print_r( $tt );
31
32echo "-- with table = HTML_SPECIALCHARS, ENT_QUOTES --\n";
33$table = HTML_SPECIALCHARS;
34$tt = get_html_translation_table($table, ENT_QUOTES | ENT_XHTML, "UTF-8");
35asort( $tt );
36var_dump( $tt );
37
38echo "-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --\n";
39$table = HTML_SPECIALCHARS;
40$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_XHTML, "UTF-8");
41asort( $tt );
42var_dump( $tt );
43
44
45echo "Done\n";
46?>
47--EXPECT--
48*** Testing get_html_translation_table() : basic functionality/XHTML 1.0 ***
49-- with table = HTML_ENTITIES, ENT_QUOTES --
50int(253)
51Array
52(
53    ['] => &#039;
54    [Æ] => &AElig;
55    [Á] => &Aacute;
56    [Â] => &Acirc;
57    [À] => &Agrave;
58    [Α] => &Alpha;
59    [Å] => &Aring;
60    [Ã] => &Atilde;
61    [Ä] => &Auml;
62    [Β] => &Beta;
63    [Ç] => &Ccedil;
64    [Χ] => &Chi;
65    [‡] => &Dagger;
66    [Δ] => &Delta;
67    [Ð] => &ETH;
68    [É] => &Eacute;
69    [Ê] => &Ecirc;
70    [È] => &Egrave;
71    [Ε] => &Epsilon;
72    [Η] => &Eta;
73    [Ë] => &Euml;
74    [Γ] => &Gamma;
75    [Í] => &Iacute;
76    [Î] => &Icirc;
77    [Ì] => &Igrave;
78    [Ι] => &Iota;
79    [Ï] => &Iuml;
80    [Κ] => &Kappa;
81    [Λ] => &Lambda;
82    [Μ] => &Mu;
83    [Ñ] => &Ntilde;
84    [Ν] => &Nu;
85    [Œ] => &OElig;
86    [Ó] => &Oacute;
87    [Ô] => &Ocirc;
88    [Ò] => &Ograve;
89    [Ω] => &Omega;
90    [Ο] => &Omicron;
91    [Ø] => &Oslash;
92    [Õ] => &Otilde;
93    [Ö] => &Ouml;
94    [Φ] => &Phi;
95    [Π] => &Pi;
96    [″] => &Prime;
97    [Ψ] => &Psi;
98    [Ρ] => &Rho;
99    [Š] => &Scaron;
100    [Σ] => &Sigma;
101    [Þ] => &THORN;
102    [Τ] => &Tau;
103    [Θ] => &Theta;
104    [Ú] => &Uacute;
105    [Û] => &Ucirc;
106    [Ù] => &Ugrave;
107    [Υ] => &Upsilon;
108    [Ü] => &Uuml;
109    [Ξ] => &Xi;
110    [Ý] => &Yacute;
111    [Ÿ] => &Yuml;
112    [Ζ] => &Zeta;
113    [á] => &aacute;
114    [â] => &acirc;
115    [´] => &acute;
116    [æ] => &aelig;
117    [à] => &agrave;
118    [ℵ] => &alefsym;
119    [α] => &alpha;
120    [&] => &amp;
121    [∧] => &and;
122    [∠] => &ang;
123    [å] => &aring;
124    [≈] => &asymp;
125    [ã] => &atilde;
126    [ä] => &auml;
127    [„] => &bdquo;
128    [β] => &beta;
129    [¦] => &brvbar;
130    [•] => &bull;
131    [∩] => &cap;
132    [ç] => &ccedil;
133    [¸] => &cedil;
134    [¢] => &cent;
135    [χ] => &chi;
136    [ˆ] => &circ;
137    [♣] => &clubs;
138    [≅] => &cong;
139    [©] => &copy;
140    [↵] => &crarr;
141    [∪] => &cup;
142    [¤] => &curren;
143    [⇓] => &dArr;
144    [†] => &dagger;
145    [↓] => &darr;
146    [°] => &deg;
147    [δ] => &delta;
148    [♦] => &diams;
149    [÷] => &divide;
150    [é] => &eacute;
151    [ê] => &ecirc;
152    [è] => &egrave;
153    [∅] => &empty;
154    [ ] => &emsp;
155    [ ] => &ensp;
156    [ε] => &epsilon;
157    [≡] => &equiv;
158    [η] => &eta;
159    [ð] => &eth;
160    [ë] => &euml;
161    [€] => &euro;
162    [∃] => &exist;
163    [ƒ] => &fnof;
164    [∀] => &forall;
165    [½] => &frac12;
166    [¼] => &frac14;
167    [¾] => &frac34;
168    [⁄] => &frasl;
169    [γ] => &gamma;
170    [≥] => &ge;
171    [>] => &gt;
172    [⇔] => &hArr;
173    [↔] => &harr;
174    [♥] => &hearts;
175    […] => &hellip;
176    [í] => &iacute;
177    [î] => &icirc;
178    [¡] => &iexcl;
179    [ì] => &igrave;
180    [ℑ] => &image;
181    [∞] => &infin;
182    [∫] => &int;
183    [ι] => &iota;
184    [¿] => &iquest;
185    [∈] => &isin;
186    [ï] => &iuml;
187    [κ] => &kappa;
188    [⇐] => &lArr;
189    [λ] => &lambda;
190    [〈] => &lang;
191    [«] => &laquo;
192    [←] => &larr;
193    [⌈] => &lceil;
194    [“] => &ldquo;
195    [≤] => &le;
196    [⌊] => &lfloor;
197    [∗] => &lowast;
198    [◊] => &loz;
199    [‎] => &lrm;
200    [‹] => &lsaquo;
201    [‘] => &lsquo;
202    [<] => &lt;
203    [¯] => &macr;
204    [—] => &mdash;
205    [µ] => &micro;
206    [·] => &middot;
207    [−] => &minus;
208    [μ] => &mu;
209    [∇] => &nabla;
210    [ ] => &nbsp;
211    [–] => &ndash;
212    [≠] => &ne;
213    [∋] => &ni;
214    [¬] => &not;
215    [∉] => &notin;
216    [⊄] => &nsub;
217    [ñ] => &ntilde;
218    [ν] => &nu;
219    [ó] => &oacute;
220    [ô] => &ocirc;
221    [œ] => &oelig;
222    [ò] => &ograve;
223    [‾] => &oline;
224    [ω] => &omega;
225    [ο] => &omicron;
226    [⊕] => &oplus;
227    [∨] => &or;
228    [ª] => &ordf;
229    [º] => &ordm;
230    [ø] => &oslash;
231    [õ] => &otilde;
232    [⊗] => &otimes;
233    [ö] => &ouml;
234    [¶] => &para;
235    [∂] => &part;
236    [‰] => &permil;
237    [⊥] => &perp;
238    [φ] => &phi;
239    [π] => &pi;
240    [ϖ] => &piv;
241    [±] => &plusmn;
242    [£] => &pound;
243    [′] => &prime;
244    [∏] => &prod;
245    [∝] => &prop;
246    [ψ] => &psi;
247    ["] => &quot;
248    [⇒] => &rArr;
249    [√] => &radic;
250    [〉] => &rang;
251    [»] => &raquo;
252    [→] => &rarr;
253    [⌉] => &rceil;
254    [”] => &rdquo;
255    [ℜ] => &real;
256    [®] => &reg;
257    [⌋] => &rfloor;
258    [ρ] => &rho;
259    [‏] => &rlm;
260    [›] => &rsaquo;
261    [’] => &rsquo;
262    [‚] => &sbquo;
263    [š] => &scaron;
264    [⋅] => &sdot;
265    [§] => &sect;
266    [­] => &shy;
267    [σ] => &sigma;
268    [ς] => &sigmaf;
269    [∼] => &sim;
270    [♠] => &spades;
271    [⊂] => &sub;
272    [⊆] => &sube;
273    [∑] => &sum;
274    [¹] => &sup1;
275    [²] => &sup2;
276    [³] => &sup3;
277    [⊃] => &sup;
278    [⊇] => &supe;
279    [ß] => &szlig;
280    [τ] => &tau;
281    [∴] => &there4;
282    [θ] => &theta;
283    [ϑ] => &thetasym;
284    [ ] => &thinsp;
285    [þ] => &thorn;
286    [˜] => &tilde;
287    [×] => &times;
288    [™] => &trade;
289    [⇑] => &uArr;
290    [ú] => &uacute;
291    [↑] => &uarr;
292    [û] => &ucirc;
293    [ù] => &ugrave;
294    [¨] => &uml;
295    [ϒ] => &upsih;
296    [υ] => &upsilon;
297    [ü] => &uuml;
298    [℘] => &weierp;
299    [ξ] => &xi;
300    [ý] => &yacute;
301    [¥] => &yen;
302    [ÿ] => &yuml;
303    [ζ] => &zeta;
304    [‍] => &zwj;
305    [‌] => &zwnj;
306)
307-- with table = HTML_ENTITIES, ENT_COMPAT --
308int(252)
309-- with table = HTML_ENTITIES, ENT_NOQUOTES --
310int(251)
311-- with table = HTML_SPECIALCHARS, ENT_COMPAT --
312int(4)
313Array
314(
315    [&] => &amp;
316    [>] => &gt;
317    [<] => &lt;
318    ["] => &quot;
319)
320-- with table = HTML_SPECIALCHARS, ENT_QUOTES --
321array(5) {
322  ["&"]=>
323  string(5) "&amp;"
324  ["'"]=>
325  string(6) "&apos;"
326  [">"]=>
327  string(4) "&gt;"
328  ["<"]=>
329  string(4) "&lt;"
330  ["""]=>
331  string(6) "&quot;"
332}
333-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --
334array(3) {
335  ["&"]=>
336  string(5) "&amp;"
337  [">"]=>
338  string(4) "&gt;"
339  ["<"]=>
340  string(4) "&lt;"
341}
342Done