1--TEST--
2Test get_html_translation_table() function : basic functionality - with default args
3--FILE--
4<?php
5/* Prototype  : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )
6 * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
7 * Source code: ext/standard/html.c
8*/
9
10/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */
11
12
13echo "*** Testing get_html_translation_table() : basic functionality ***\n";
14
15echo "-- with table = HTML_ENTITIES --\n";
16$table = HTML_ENTITIES;
17$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
18asort($tt);
19var_dump( $tt );
20
21echo "-- with table = HTML_SPECIALCHARS --\n";
22$table = HTML_SPECIALCHARS;
23$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
24asort($tt);
25var_dump( $tt );
26
27echo "Done\n";
28?>
29--EXPECT--
30*** Testing get_html_translation_table() : basic functionality ***
31-- with table = HTML_ENTITIES --
32array(252) {
33  ["Æ"]=>
34  string(7) "&AElig;"
35  ["Á"]=>
36  string(8) "&Aacute;"
37  ["Â"]=>
38  string(7) "&Acirc;"
39  ["À"]=>
40  string(8) "&Agrave;"
41  ["Α"]=>
42  string(7) "&Alpha;"
43  ["Å"]=>
44  string(7) "&Aring;"
45  ["Ã"]=>
46  string(8) "&Atilde;"
47  ["Ä"]=>
48  string(6) "&Auml;"
49  ["Β"]=>
50  string(6) "&Beta;"
51  ["Ç"]=>
52  string(8) "&Ccedil;"
53  ["Χ"]=>
54  string(5) "&Chi;"
55  ["‡"]=>
56  string(8) "&Dagger;"
57  ["Δ"]=>
58  string(7) "&Delta;"
59  ["Ð"]=>
60  string(5) "&ETH;"
61  ["É"]=>
62  string(8) "&Eacute;"
63  ["Ê"]=>
64  string(7) "&Ecirc;"
65  ["È"]=>
66  string(8) "&Egrave;"
67  ["Ε"]=>
68  string(9) "&Epsilon;"
69  ["Η"]=>
70  string(5) "&Eta;"
71  ["Ë"]=>
72  string(6) "&Euml;"
73  ["Γ"]=>
74  string(7) "&Gamma;"
75  ["Í"]=>
76  string(8) "&Iacute;"
77  ["Î"]=>
78  string(7) "&Icirc;"
79  ["Ì"]=>
80  string(8) "&Igrave;"
81  ["Ι"]=>
82  string(6) "&Iota;"
83  ["Ï"]=>
84  string(6) "&Iuml;"
85  ["Κ"]=>
86  string(7) "&Kappa;"
87  ["Λ"]=>
88  string(8) "&Lambda;"
89  ["Μ"]=>
90  string(4) "&Mu;"
91  ["Ñ"]=>
92  string(8) "&Ntilde;"
93  ["Ν"]=>
94  string(4) "&Nu;"
95  ["Œ"]=>
96  string(7) "&OElig;"
97  ["Ó"]=>
98  string(8) "&Oacute;"
99  ["Ô"]=>
100  string(7) "&Ocirc;"
101  ["Ò"]=>
102  string(8) "&Ograve;"
103  ["Ω"]=>
104  string(7) "&Omega;"
105  ["Ο"]=>
106  string(9) "&Omicron;"
107  ["Ø"]=>
108  string(8) "&Oslash;"
109  ["Õ"]=>
110  string(8) "&Otilde;"
111  ["Ö"]=>
112  string(6) "&Ouml;"
113  ["Φ"]=>
114  string(5) "&Phi;"
115  ["Π"]=>
116  string(4) "&Pi;"
117  ["″"]=>
118  string(7) "&Prime;"
119  ["Ψ"]=>
120  string(5) "&Psi;"
121  ["Ρ"]=>
122  string(5) "&Rho;"
123  ["Š"]=>
124  string(8) "&Scaron;"
125  ["Σ"]=>
126  string(7) "&Sigma;"
127  ["Þ"]=>
128  string(7) "&THORN;"
129  ["Τ"]=>
130  string(5) "&Tau;"
131  ["Θ"]=>
132  string(7) "&Theta;"
133  ["Ú"]=>
134  string(8) "&Uacute;"
135  ["Û"]=>
136  string(7) "&Ucirc;"
137  ["Ù"]=>
138  string(8) "&Ugrave;"
139  ["Υ"]=>
140  string(9) "&Upsilon;"
141  ["Ü"]=>
142  string(6) "&Uuml;"
143  ["Ξ"]=>
144  string(4) "&Xi;"
145  ["Ý"]=>
146  string(8) "&Yacute;"
147  ["Ÿ"]=>
148  string(6) "&Yuml;"
149  ["Ζ"]=>
150  string(6) "&Zeta;"
151  ["á"]=>
152  string(8) "&aacute;"
153  ["â"]=>
154  string(7) "&acirc;"
155  ["´"]=>
156  string(7) "&acute;"
157  ["æ"]=>
158  string(7) "&aelig;"
159  ["à"]=>
160  string(8) "&agrave;"
161  ["ℵ"]=>
162  string(9) "&alefsym;"
163  ["α"]=>
164  string(7) "&alpha;"
165  ["&"]=>
166  string(5) "&amp;"
167  ["∧"]=>
168  string(5) "&and;"
169  ["∠"]=>
170  string(5) "&ang;"
171  ["å"]=>
172  string(7) "&aring;"
173  ["≈"]=>
174  string(7) "&asymp;"
175  ["ã"]=>
176  string(8) "&atilde;"
177  ["ä"]=>
178  string(6) "&auml;"
179  ["„"]=>
180  string(7) "&bdquo;"
181  ["β"]=>
182  string(6) "&beta;"
183  ["¦"]=>
184  string(8) "&brvbar;"
185  ["•"]=>
186  string(6) "&bull;"
187  ["∩"]=>
188  string(5) "&cap;"
189  ["ç"]=>
190  string(8) "&ccedil;"
191  ["¸"]=>
192  string(7) "&cedil;"
193  ["¢"]=>
194  string(6) "&cent;"
195  ["χ"]=>
196  string(5) "&chi;"
197  ["ˆ"]=>
198  string(6) "&circ;"
199  ["♣"]=>
200  string(7) "&clubs;"
201  ["≅"]=>
202  string(6) "&cong;"
203  ["©"]=>
204  string(6) "&copy;"
205  ["↵"]=>
206  string(7) "&crarr;"
207  ["∪"]=>
208  string(5) "&cup;"
209  ["¤"]=>
210  string(8) "&curren;"
211  ["⇓"]=>
212  string(6) "&dArr;"
213  ["†"]=>
214  string(8) "&dagger;"
215  ["↓"]=>
216  string(6) "&darr;"
217  ["°"]=>
218  string(5) "&deg;"
219  ["δ"]=>
220  string(7) "&delta;"
221  ["♦"]=>
222  string(7) "&diams;"
223  ["÷"]=>
224  string(8) "&divide;"
225  ["é"]=>
226  string(8) "&eacute;"
227  ["ê"]=>
228  string(7) "&ecirc;"
229  ["è"]=>
230  string(8) "&egrave;"
231  ["∅"]=>
232  string(7) "&empty;"
233  [" "]=>
234  string(6) "&emsp;"
235  [" "]=>
236  string(6) "&ensp;"
237  ["ε"]=>
238  string(9) "&epsilon;"
239  ["≡"]=>
240  string(7) "&equiv;"
241  ["η"]=>
242  string(5) "&eta;"
243  ["ð"]=>
244  string(5) "&eth;"
245  ["ë"]=>
246  string(6) "&euml;"
247  ["€"]=>
248  string(6) "&euro;"
249  ["∃"]=>
250  string(7) "&exist;"
251  ["ƒ"]=>
252  string(6) "&fnof;"
253  ["∀"]=>
254  string(8) "&forall;"
255  ["½"]=>
256  string(8) "&frac12;"
257  ["¼"]=>
258  string(8) "&frac14;"
259  ["¾"]=>
260  string(8) "&frac34;"
261  ["⁄"]=>
262  string(7) "&frasl;"
263  ["γ"]=>
264  string(7) "&gamma;"
265  ["≥"]=>
266  string(4) "&ge;"
267  [">"]=>
268  string(4) "&gt;"
269  ["⇔"]=>
270  string(6) "&hArr;"
271  ["↔"]=>
272  string(6) "&harr;"
273  ["♥"]=>
274  string(8) "&hearts;"
275  ["…"]=>
276  string(8) "&hellip;"
277  ["í"]=>
278  string(8) "&iacute;"
279  ["î"]=>
280  string(7) "&icirc;"
281  ["¡"]=>
282  string(7) "&iexcl;"
283  ["ì"]=>
284  string(8) "&igrave;"
285  ["ℑ"]=>
286  string(7) "&image;"
287  ["∞"]=>
288  string(7) "&infin;"
289  ["∫"]=>
290  string(5) "&int;"
291  ["ι"]=>
292  string(6) "&iota;"
293  ["¿"]=>
294  string(8) "&iquest;"
295  ["∈"]=>
296  string(6) "&isin;"
297  ["ï"]=>
298  string(6) "&iuml;"
299  ["κ"]=>
300  string(7) "&kappa;"
301  ["⇐"]=>
302  string(6) "&lArr;"
303  ["λ"]=>
304  string(8) "&lambda;"
305  ["〈"]=>
306  string(6) "&lang;"
307  ["«"]=>
308  string(7) "&laquo;"
309  ["←"]=>
310  string(6) "&larr;"
311  ["⌈"]=>
312  string(7) "&lceil;"
313  ["“"]=>
314  string(7) "&ldquo;"
315  ["≤"]=>
316  string(4) "&le;"
317  ["⌊"]=>
318  string(8) "&lfloor;"
319  ["∗"]=>
320  string(8) "&lowast;"
321  ["◊"]=>
322  string(5) "&loz;"
323  ["‎"]=>
324  string(5) "&lrm;"
325  ["‹"]=>
326  string(8) "&lsaquo;"
327  ["‘"]=>
328  string(7) "&lsquo;"
329  ["<"]=>
330  string(4) "&lt;"
331  ["¯"]=>
332  string(6) "&macr;"
333  ["—"]=>
334  string(7) "&mdash;"
335  ["µ"]=>
336  string(7) "&micro;"
337  ["·"]=>
338  string(8) "&middot;"
339  ["−"]=>
340  string(7) "&minus;"
341  ["μ"]=>
342  string(4) "&mu;"
343  ["∇"]=>
344  string(7) "&nabla;"
345  [" "]=>
346  string(6) "&nbsp;"
347  ["–"]=>
348  string(7) "&ndash;"
349  ["≠"]=>
350  string(4) "&ne;"
351  ["∋"]=>
352  string(4) "&ni;"
353  ["¬"]=>
354  string(5) "&not;"
355  ["∉"]=>
356  string(7) "&notin;"
357  ["⊄"]=>
358  string(6) "&nsub;"
359  ["ñ"]=>
360  string(8) "&ntilde;"
361  ["ν"]=>
362  string(4) "&nu;"
363  ["ó"]=>
364  string(8) "&oacute;"
365  ["ô"]=>
366  string(7) "&ocirc;"
367  ["œ"]=>
368  string(7) "&oelig;"
369  ["ò"]=>
370  string(8) "&ograve;"
371  ["‾"]=>
372  string(7) "&oline;"
373  ["ω"]=>
374  string(7) "&omega;"
375  ["ο"]=>
376  string(9) "&omicron;"
377  ["⊕"]=>
378  string(7) "&oplus;"
379  ["∨"]=>
380  string(4) "&or;"
381  ["ª"]=>
382  string(6) "&ordf;"
383  ["º"]=>
384  string(6) "&ordm;"
385  ["ø"]=>
386  string(8) "&oslash;"
387  ["õ"]=>
388  string(8) "&otilde;"
389  ["⊗"]=>
390  string(8) "&otimes;"
391  ["ö"]=>
392  string(6) "&ouml;"
393  ["¶"]=>
394  string(6) "&para;"
395  ["∂"]=>
396  string(6) "&part;"
397  ["‰"]=>
398  string(8) "&permil;"
399  ["⊥"]=>
400  string(6) "&perp;"
401  ["φ"]=>
402  string(5) "&phi;"
403  ["π"]=>
404  string(4) "&pi;"
405  ["ϖ"]=>
406  string(5) "&piv;"
407  ["±"]=>
408  string(8) "&plusmn;"
409  ["£"]=>
410  string(7) "&pound;"
411  ["′"]=>
412  string(7) "&prime;"
413  ["∏"]=>
414  string(6) "&prod;"
415  ["∝"]=>
416  string(6) "&prop;"
417  ["ψ"]=>
418  string(5) "&psi;"
419  ["""]=>
420  string(6) "&quot;"
421  ["⇒"]=>
422  string(6) "&rArr;"
423  ["√"]=>
424  string(7) "&radic;"
425  ["〉"]=>
426  string(6) "&rang;"
427  ["»"]=>
428  string(7) "&raquo;"
429  ["→"]=>
430  string(6) "&rarr;"
431  ["⌉"]=>
432  string(7) "&rceil;"
433  ["”"]=>
434  string(7) "&rdquo;"
435  ["ℜ"]=>
436  string(6) "&real;"
437  ["®"]=>
438  string(5) "&reg;"
439  ["⌋"]=>
440  string(8) "&rfloor;"
441  ["ρ"]=>
442  string(5) "&rho;"
443  ["‏"]=>
444  string(5) "&rlm;"
445  ["›"]=>
446  string(8) "&rsaquo;"
447  ["’"]=>
448  string(7) "&rsquo;"
449  ["‚"]=>
450  string(7) "&sbquo;"
451  ["š"]=>
452  string(8) "&scaron;"
453  ["⋅"]=>
454  string(6) "&sdot;"
455  ["§"]=>
456  string(6) "&sect;"
457  ["­"]=>
458  string(5) "&shy;"
459  ["σ"]=>
460  string(7) "&sigma;"
461  ["ς"]=>
462  string(8) "&sigmaf;"
463  ["∼"]=>
464  string(5) "&sim;"
465  ["♠"]=>
466  string(8) "&spades;"
467  ["⊂"]=>
468  string(5) "&sub;"
469  ["⊆"]=>
470  string(6) "&sube;"
471  ["∑"]=>
472  string(5) "&sum;"
473  ["¹"]=>
474  string(6) "&sup1;"
475  ["²"]=>
476  string(6) "&sup2;"
477  ["³"]=>
478  string(6) "&sup3;"
479  ["⊃"]=>
480  string(5) "&sup;"
481  ["⊇"]=>
482  string(6) "&supe;"
483  ["ß"]=>
484  string(7) "&szlig;"
485  ["τ"]=>
486  string(5) "&tau;"
487  ["∴"]=>
488  string(8) "&there4;"
489  ["θ"]=>
490  string(7) "&theta;"
491  ["ϑ"]=>
492  string(10) "&thetasym;"
493  [" "]=>
494  string(8) "&thinsp;"
495  ["þ"]=>
496  string(7) "&thorn;"
497  ["˜"]=>
498  string(7) "&tilde;"
499  ["×"]=>
500  string(7) "&times;"
501  ["™"]=>
502  string(7) "&trade;"
503  ["⇑"]=>
504  string(6) "&uArr;"
505  ["ú"]=>
506  string(8) "&uacute;"
507  ["↑"]=>
508  string(6) "&uarr;"
509  ["û"]=>
510  string(7) "&ucirc;"
511  ["ù"]=>
512  string(8) "&ugrave;"
513  ["¨"]=>
514  string(5) "&uml;"
515  ["ϒ"]=>
516  string(7) "&upsih;"
517  ["υ"]=>
518  string(9) "&upsilon;"
519  ["ü"]=>
520  string(6) "&uuml;"
521  ["℘"]=>
522  string(8) "&weierp;"
523  ["ξ"]=>
524  string(4) "&xi;"
525  ["ý"]=>
526  string(8) "&yacute;"
527  ["¥"]=>
528  string(5) "&yen;"
529  ["ÿ"]=>
530  string(6) "&yuml;"
531  ["ζ"]=>
532  string(6) "&zeta;"
533  ["‍"]=>
534  string(5) "&zwj;"
535  ["‌"]=>
536  string(6) "&zwnj;"
537}
538-- with table = HTML_SPECIALCHARS --
539array(4) {
540  ["&"]=>
541  string(5) "&amp;"
542  [">"]=>
543  string(4) "&gt;"
544  ["<"]=>
545  string(4) "&lt;"
546  ["""]=>
547  string(6) "&quot;"
548}
549Done
550