mirror of
https://github.com/php/php-src.git
synced 2024-10-20 07:53:58 +00:00
674 lines
11 KiB
PHP
674 lines
11 KiB
PHP
--TEST--
|
||
Test get_html_translation_table() function : basic functionality - table as HTML_ENTITIES & diff quote_style
|
||
--SKIPIF--
|
||
<?php
|
||
if( substr(PHP_OS, 0, 3) != "WIN"){
|
||
die('skip only for Windows');
|
||
}
|
||
|
||
if( !setlocale(LC_ALL, "English_United States.1252") ) {
|
||
die('skip failed to set locale settings to "English_United States.1252"');
|
||
}
|
||
|
||
?>
|
||
--FILE--
|
||
<?php
|
||
/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style]] )
|
||
* Description: Returns the internal translation table used by htmlspecialchars and htmlentities
|
||
* Source code: ext/standard/html.c
|
||
*/
|
||
|
||
/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */
|
||
|
||
//set locale
|
||
setlocale(LC_ALL, "English_United States.1252");
|
||
|
||
|
||
echo "*** Testing get_html_translation_table() : basic functionality ***\n";
|
||
|
||
// Calling get_html_translation_table() with default arguments
|
||
echo "-- with default arguments --\n";
|
||
var_dump( get_html_translation_table() );
|
||
|
||
// Calling get_html_translation_table() with all arguments
|
||
// $table as HTML_ENTITIES and different quote style
|
||
echo "-- with table = HTML_ENTITIES & quote_style = ENT_COMPAT --\n";
|
||
$table = HTML_ENTITIES;
|
||
$quote_style = ENT_COMPAT;
|
||
var_dump( get_html_translation_table($table, $quote_style) );
|
||
|
||
echo "-- with table = HTML_ENTITIES & quote_style = ENT_QUOTES --\n";
|
||
$quote_style = ENT_QUOTES;
|
||
var_dump( get_html_translation_table($table, $quote_style) );
|
||
|
||
echo "-- with table = HTML_ENTITIES & quote_style = ENT_NOQUOTES --\n";
|
||
$quote_style = ENT_NOQUOTES;
|
||
var_dump( get_html_translation_table($table, $quote_style) );
|
||
|
||
|
||
echo "Done\n";
|
||
?>
|
||
--EXPECTF--
|
||
*** Testing get_html_translation_table() : basic functionality ***
|
||
-- with default arguments --
|
||
array(4) {
|
||
["""]=>
|
||
string(6) """
|
||
["<"]=>
|
||
string(4) "<"
|
||
[">"]=>
|
||
string(4) ">"
|
||
["&"]=>
|
||
string(5) "&"
|
||
}
|
||
-- with table = HTML_ENTITIES & quote_style = ENT_COMPAT --
|
||
array(100) {
|
||
[" "]=>
|
||
string(6) " "
|
||
["¡"]=>
|
||
string(7) "¡"
|
||
["¢"]=>
|
||
string(6) "¢"
|
||
["£"]=>
|
||
string(7) "£"
|
||
["¤"]=>
|
||
string(8) "¤"
|
||
["¥"]=>
|
||
string(5) "¥"
|
||
["¦"]=>
|
||
string(8) "¦"
|
||
["§"]=>
|
||
string(6) "§"
|
||
["¨"]=>
|
||
string(5) "¨"
|
||
["©"]=>
|
||
string(6) "©"
|
||
["ª"]=>
|
||
string(6) "ª"
|
||
["«"]=>
|
||
string(7) "«"
|
||
["¬"]=>
|
||
string(5) "¬"
|
||
[""]=>
|
||
string(5) "­"
|
||
["®"]=>
|
||
string(5) "®"
|
||
["¯"]=>
|
||
string(6) "¯"
|
||
["°"]=>
|
||
string(5) "°"
|
||
["±"]=>
|
||
string(8) "±"
|
||
["²"]=>
|
||
string(6) "²"
|
||
["³"]=>
|
||
string(6) "³"
|
||
["´"]=>
|
||
string(7) "´"
|
||
["µ"]=>
|
||
string(7) "µ"
|
||
["¶"]=>
|
||
string(6) "¶"
|
||
["·"]=>
|
||
string(8) "·"
|
||
["¸"]=>
|
||
string(7) "¸"
|
||
["¹"]=>
|
||
string(6) "¹"
|
||
["º"]=>
|
||
string(6) "º"
|
||
["»"]=>
|
||
string(7) "»"
|
||
["¼"]=>
|
||
string(8) "¼"
|
||
["½"]=>
|
||
string(8) "½"
|
||
["¾"]=>
|
||
string(8) "¾"
|
||
["¿"]=>
|
||
string(8) "¿"
|
||
["À"]=>
|
||
string(8) "À"
|
||
["Á"]=>
|
||
string(8) "Á"
|
||
["Â"]=>
|
||
string(7) "Â"
|
||
["Ã"]=>
|
||
string(8) "Ã"
|
||
["Ä"]=>
|
||
string(6) "Ä"
|
||
["Å"]=>
|
||
string(7) "Å"
|
||
["Æ"]=>
|
||
string(7) "Æ"
|
||
["Ç"]=>
|
||
string(8) "Ç"
|
||
["È"]=>
|
||
string(8) "È"
|
||
["É"]=>
|
||
string(8) "É"
|
||
["Ê"]=>
|
||
string(7) "Ê"
|
||
["Ë"]=>
|
||
string(6) "Ë"
|
||
["Ì"]=>
|
||
string(8) "Ì"
|
||
["Í"]=>
|
||
string(8) "Í"
|
||
["Î"]=>
|
||
string(7) "Î"
|
||
["Ï"]=>
|
||
string(6) "Ï"
|
||
["Ð"]=>
|
||
string(5) "Ð"
|
||
["Ñ"]=>
|
||
string(8) "Ñ"
|
||
["Ò"]=>
|
||
string(8) "Ò"
|
||
["Ó"]=>
|
||
string(8) "Ó"
|
||
["Ô"]=>
|
||
string(7) "Ô"
|
||
["Õ"]=>
|
||
string(8) "Õ"
|
||
["Ö"]=>
|
||
string(6) "Ö"
|
||
["×"]=>
|
||
string(7) "×"
|
||
["Ø"]=>
|
||
string(8) "Ø"
|
||
["Ù"]=>
|
||
string(8) "Ù"
|
||
["Ú"]=>
|
||
string(8) "Ú"
|
||
["Û"]=>
|
||
string(7) "Û"
|
||
["Ü"]=>
|
||
string(6) "Ü"
|
||
["Ý"]=>
|
||
string(8) "Ý"
|
||
["Þ"]=>
|
||
string(7) "Þ"
|
||
["ß"]=>
|
||
string(7) "ß"
|
||
["à"]=>
|
||
string(8) "à"
|
||
["á"]=>
|
||
string(8) "á"
|
||
["â"]=>
|
||
string(7) "â"
|
||
["ã"]=>
|
||
string(8) "ã"
|
||
["ä"]=>
|
||
string(6) "ä"
|
||
["å"]=>
|
||
string(7) "å"
|
||
["æ"]=>
|
||
string(7) "æ"
|
||
["ç"]=>
|
||
string(8) "ç"
|
||
["è"]=>
|
||
string(8) "è"
|
||
["é"]=>
|
||
string(8) "é"
|
||
["ê"]=>
|
||
string(7) "ê"
|
||
["ë"]=>
|
||
string(6) "ë"
|
||
["ì"]=>
|
||
string(8) "ì"
|
||
["í"]=>
|
||
string(8) "í"
|
||
["î"]=>
|
||
string(7) "î"
|
||
["ï"]=>
|
||
string(6) "ï"
|
||
["ð"]=>
|
||
string(5) "ð"
|
||
["ñ"]=>
|
||
string(8) "ñ"
|
||
["ò"]=>
|
||
string(8) "ò"
|
||
["ó"]=>
|
||
string(8) "ó"
|
||
["ô"]=>
|
||
string(7) "ô"
|
||
["õ"]=>
|
||
string(8) "õ"
|
||
["ö"]=>
|
||
string(6) "ö"
|
||
["÷"]=>
|
||
string(8) "÷"
|
||
["ø"]=>
|
||
string(8) "ø"
|
||
["ù"]=>
|
||
string(8) "ù"
|
||
["ú"]=>
|
||
string(8) "ú"
|
||
["û"]=>
|
||
string(7) "û"
|
||
["ü"]=>
|
||
string(6) "ü"
|
||
["ý"]=>
|
||
string(8) "ý"
|
||
["þ"]=>
|
||
string(7) "þ"
|
||
["ÿ"]=>
|
||
string(6) "ÿ"
|
||
["""]=>
|
||
string(6) """
|
||
["<"]=>
|
||
string(4) "<"
|
||
[">"]=>
|
||
string(4) ">"
|
||
["&"]=>
|
||
string(5) "&"
|
||
}
|
||
-- with table = HTML_ENTITIES & quote_style = ENT_QUOTES --
|
||
array(101) {
|
||
[" "]=>
|
||
string(6) " "
|
||
["¡"]=>
|
||
string(7) "¡"
|
||
["¢"]=>
|
||
string(6) "¢"
|
||
["£"]=>
|
||
string(7) "£"
|
||
["¤"]=>
|
||
string(8) "¤"
|
||
["¥"]=>
|
||
string(5) "¥"
|
||
["¦"]=>
|
||
string(8) "¦"
|
||
["§"]=>
|
||
string(6) "§"
|
||
["¨"]=>
|
||
string(5) "¨"
|
||
["©"]=>
|
||
string(6) "©"
|
||
["ª"]=>
|
||
string(6) "ª"
|
||
["«"]=>
|
||
string(7) "«"
|
||
["¬"]=>
|
||
string(5) "¬"
|
||
[""]=>
|
||
string(5) "­"
|
||
["®"]=>
|
||
string(5) "®"
|
||
["¯"]=>
|
||
string(6) "¯"
|
||
["°"]=>
|
||
string(5) "°"
|
||
["±"]=>
|
||
string(8) "±"
|
||
["²"]=>
|
||
string(6) "²"
|
||
["³"]=>
|
||
string(6) "³"
|
||
["´"]=>
|
||
string(7) "´"
|
||
["µ"]=>
|
||
string(7) "µ"
|
||
["¶"]=>
|
||
string(6) "¶"
|
||
["·"]=>
|
||
string(8) "·"
|
||
["¸"]=>
|
||
string(7) "¸"
|
||
["¹"]=>
|
||
string(6) "¹"
|
||
["º"]=>
|
||
string(6) "º"
|
||
["»"]=>
|
||
string(7) "»"
|
||
["¼"]=>
|
||
string(8) "¼"
|
||
["½"]=>
|
||
string(8) "½"
|
||
["¾"]=>
|
||
string(8) "¾"
|
||
["¿"]=>
|
||
string(8) "¿"
|
||
["À"]=>
|
||
string(8) "À"
|
||
["Á"]=>
|
||
string(8) "Á"
|
||
["Â"]=>
|
||
string(7) "Â"
|
||
["Ã"]=>
|
||
string(8) "Ã"
|
||
["Ä"]=>
|
||
string(6) "Ä"
|
||
["Å"]=>
|
||
string(7) "Å"
|
||
["Æ"]=>
|
||
string(7) "Æ"
|
||
["Ç"]=>
|
||
string(8) "Ç"
|
||
["È"]=>
|
||
string(8) "È"
|
||
["É"]=>
|
||
string(8) "É"
|
||
["Ê"]=>
|
||
string(7) "Ê"
|
||
["Ë"]=>
|
||
string(6) "Ë"
|
||
["Ì"]=>
|
||
string(8) "Ì"
|
||
["Í"]=>
|
||
string(8) "Í"
|
||
["Î"]=>
|
||
string(7) "Î"
|
||
["Ï"]=>
|
||
string(6) "Ï"
|
||
["Ð"]=>
|
||
string(5) "Ð"
|
||
["Ñ"]=>
|
||
string(8) "Ñ"
|
||
["Ò"]=>
|
||
string(8) "Ò"
|
||
["Ó"]=>
|
||
string(8) "Ó"
|
||
["Ô"]=>
|
||
string(7) "Ô"
|
||
["Õ"]=>
|
||
string(8) "Õ"
|
||
["Ö"]=>
|
||
string(6) "Ö"
|
||
["×"]=>
|
||
string(7) "×"
|
||
["Ø"]=>
|
||
string(8) "Ø"
|
||
["Ù"]=>
|
||
string(8) "Ù"
|
||
["Ú"]=>
|
||
string(8) "Ú"
|
||
["Û"]=>
|
||
string(7) "Û"
|
||
["Ü"]=>
|
||
string(6) "Ü"
|
||
["Ý"]=>
|
||
string(8) "Ý"
|
||
["Þ"]=>
|
||
string(7) "Þ"
|
||
["ß"]=>
|
||
string(7) "ß"
|
||
["à"]=>
|
||
string(8) "à"
|
||
["á"]=>
|
||
string(8) "á"
|
||
["â"]=>
|
||
string(7) "â"
|
||
["ã"]=>
|
||
string(8) "ã"
|
||
["ä"]=>
|
||
string(6) "ä"
|
||
["å"]=>
|
||
string(7) "å"
|
||
["æ"]=>
|
||
string(7) "æ"
|
||
["ç"]=>
|
||
string(8) "ç"
|
||
["è"]=>
|
||
string(8) "è"
|
||
["é"]=>
|
||
string(8) "é"
|
||
["ê"]=>
|
||
string(7) "ê"
|
||
["ë"]=>
|
||
string(6) "ë"
|
||
["ì"]=>
|
||
string(8) "ì"
|
||
["í"]=>
|
||
string(8) "í"
|
||
["î"]=>
|
||
string(7) "î"
|
||
["ï"]=>
|
||
string(6) "ï"
|
||
["ð"]=>
|
||
string(5) "ð"
|
||
["ñ"]=>
|
||
string(8) "ñ"
|
||
["ò"]=>
|
||
string(8) "ò"
|
||
["ó"]=>
|
||
string(8) "ó"
|
||
["ô"]=>
|
||
string(7) "ô"
|
||
["õ"]=>
|
||
string(8) "õ"
|
||
["ö"]=>
|
||
string(6) "ö"
|
||
["÷"]=>
|
||
string(8) "÷"
|
||
["ø"]=>
|
||
string(8) "ø"
|
||
["ù"]=>
|
||
string(8) "ù"
|
||
["ú"]=>
|
||
string(8) "ú"
|
||
["û"]=>
|
||
string(7) "û"
|
||
["ü"]=>
|
||
string(6) "ü"
|
||
["ý"]=>
|
||
string(8) "ý"
|
||
["þ"]=>
|
||
string(7) "þ"
|
||
["ÿ"]=>
|
||
string(6) "ÿ"
|
||
["""]=>
|
||
string(6) """
|
||
["'"]=>
|
||
string(5) "'"
|
||
["<"]=>
|
||
string(4) "<"
|
||
[">"]=>
|
||
string(4) ">"
|
||
["&"]=>
|
||
string(5) "&"
|
||
}
|
||
-- with table = HTML_ENTITIES & quote_style = ENT_NOQUOTES --
|
||
array(99) {
|
||
[" "]=>
|
||
string(6) " "
|
||
["¡"]=>
|
||
string(7) "¡"
|
||
["¢"]=>
|
||
string(6) "¢"
|
||
["£"]=>
|
||
string(7) "£"
|
||
["¤"]=>
|
||
string(8) "¤"
|
||
["¥"]=>
|
||
string(5) "¥"
|
||
["¦"]=>
|
||
string(8) "¦"
|
||
["§"]=>
|
||
string(6) "§"
|
||
["¨"]=>
|
||
string(5) "¨"
|
||
["©"]=>
|
||
string(6) "©"
|
||
["ª"]=>
|
||
string(6) "ª"
|
||
["«"]=>
|
||
string(7) "«"
|
||
["¬"]=>
|
||
string(5) "¬"
|
||
[""]=>
|
||
string(5) "­"
|
||
["®"]=>
|
||
string(5) "®"
|
||
["¯"]=>
|
||
string(6) "¯"
|
||
["°"]=>
|
||
string(5) "°"
|
||
["±"]=>
|
||
string(8) "±"
|
||
["²"]=>
|
||
string(6) "²"
|
||
["³"]=>
|
||
string(6) "³"
|
||
["´"]=>
|
||
string(7) "´"
|
||
["µ"]=>
|
||
string(7) "µ"
|
||
["¶"]=>
|
||
string(6) "¶"
|
||
["·"]=>
|
||
string(8) "·"
|
||
["¸"]=>
|
||
string(7) "¸"
|
||
["¹"]=>
|
||
string(6) "¹"
|
||
["º"]=>
|
||
string(6) "º"
|
||
["»"]=>
|
||
string(7) "»"
|
||
["¼"]=>
|
||
string(8) "¼"
|
||
["½"]=>
|
||
string(8) "½"
|
||
["¾"]=>
|
||
string(8) "¾"
|
||
["¿"]=>
|
||
string(8) "¿"
|
||
["À"]=>
|
||
string(8) "À"
|
||
["Á"]=>
|
||
string(8) "Á"
|
||
["Â"]=>
|
||
string(7) "Â"
|
||
["Ã"]=>
|
||
string(8) "Ã"
|
||
["Ä"]=>
|
||
string(6) "Ä"
|
||
["Å"]=>
|
||
string(7) "Å"
|
||
["Æ"]=>
|
||
string(7) "Æ"
|
||
["Ç"]=>
|
||
string(8) "Ç"
|
||
["È"]=>
|
||
string(8) "È"
|
||
["É"]=>
|
||
string(8) "É"
|
||
["Ê"]=>
|
||
string(7) "Ê"
|
||
["Ë"]=>
|
||
string(6) "Ë"
|
||
["Ì"]=>
|
||
string(8) "Ì"
|
||
["Í"]=>
|
||
string(8) "Í"
|
||
["Î"]=>
|
||
string(7) "Î"
|
||
["Ï"]=>
|
||
string(6) "Ï"
|
||
["Ð"]=>
|
||
string(5) "Ð"
|
||
["Ñ"]=>
|
||
string(8) "Ñ"
|
||
["Ò"]=>
|
||
string(8) "Ò"
|
||
["Ó"]=>
|
||
string(8) "Ó"
|
||
["Ô"]=>
|
||
string(7) "Ô"
|
||
["Õ"]=>
|
||
string(8) "Õ"
|
||
["Ö"]=>
|
||
string(6) "Ö"
|
||
["×"]=>
|
||
string(7) "×"
|
||
["Ø"]=>
|
||
string(8) "Ø"
|
||
["Ù"]=>
|
||
string(8) "Ù"
|
||
["Ú"]=>
|
||
string(8) "Ú"
|
||
["Û"]=>
|
||
string(7) "Û"
|
||
["Ü"]=>
|
||
string(6) "Ü"
|
||
["Ý"]=>
|
||
string(8) "Ý"
|
||
["Þ"]=>
|
||
string(7) "Þ"
|
||
["ß"]=>
|
||
string(7) "ß"
|
||
["à"]=>
|
||
string(8) "à"
|
||
["á"]=>
|
||
string(8) "á"
|
||
["â"]=>
|
||
string(7) "â"
|
||
["ã"]=>
|
||
string(8) "ã"
|
||
["ä"]=>
|
||
string(6) "ä"
|
||
["å"]=>
|
||
string(7) "å"
|
||
["æ"]=>
|
||
string(7) "æ"
|
||
["ç"]=>
|
||
string(8) "ç"
|
||
["è"]=>
|
||
string(8) "è"
|
||
["é"]=>
|
||
string(8) "é"
|
||
["ê"]=>
|
||
string(7) "ê"
|
||
["ë"]=>
|
||
string(6) "ë"
|
||
["ì"]=>
|
||
string(8) "ì"
|
||
["í"]=>
|
||
string(8) "í"
|
||
["î"]=>
|
||
string(7) "î"
|
||
["ï"]=>
|
||
string(6) "ï"
|
||
["ð"]=>
|
||
string(5) "ð"
|
||
["ñ"]=>
|
||
string(8) "ñ"
|
||
["ò"]=>
|
||
string(8) "ò"
|
||
["ó"]=>
|
||
string(8) "ó"
|
||
["ô"]=>
|
||
string(7) "ô"
|
||
["õ"]=>
|
||
string(8) "õ"
|
||
["ö"]=>
|
||
string(6) "ö"
|
||
["÷"]=>
|
||
string(8) "÷"
|
||
["ø"]=>
|
||
string(8) "ø"
|
||
["ù"]=>
|
||
string(8) "ù"
|
||
["ú"]=>
|
||
string(8) "ú"
|
||
["û"]=>
|
||
string(7) "û"
|
||
["ü"]=>
|
||
string(6) "ü"
|
||
["ý"]=>
|
||
string(8) "ý"
|
||
["þ"]=>
|
||
string(7) "þ"
|
||
["ÿ"]=>
|
||
string(6) "ÿ"
|
||
["<"]=>
|
||
string(4) "<"
|
||
[">"]=>
|
||
string(4) ">"
|
||
["&"]=>
|
||
string(5) "&"
|
||
}
|
||
Done
|