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