get_html_translation_table_variation1.phpt [plain text]
--TEST--
Test get_html_translation_table() function : usage variations - unexpected table values
--FILE--
<?php
echo "*** Testing get_html_translation_table() : usage variations ***\n";
$quote_style = ENT_COMPAT;
$unset_var = 10;
unset($unset_var);
$fp = fopen(__FILE__, "r");
$values = array (
array(),
array(0),
array(1),
array(1, 2),
array('color' => 'red', 'item' => 'pen'),
true,
false,
TRUE,
FALSE,
"string",
'string',
new stdclass(),
"",
'',
NULL,
null,
$fp,
@$undefined_var,
@$unset_var
);
echo "\n--- Testing get_html_translation_table() by supplying different values for 'table' argument ---\n";
$counter = 1;
for($index = 0; $index < count($values); $index ++) {
echo "-- Iteration $counter --\n";
$table = $values [$index];
$v = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
if (is_array($v) && count($v) > 100)
var_dump(count($v));
elseif (is_array($v)) {
asort($v);
var_dump($v);
} else {
var_dump($v);
}
$v = get_html_translation_table($table, $quote_style, "UTF-8");
if (is_array($v) && count($v) > 100)
var_dump(count($v));
elseif (is_array($v)) {
asort($v);
var_dump($v);
} else {
var_dump($v);
}
$counter ++;
}
fclose($fp);
echo "Done\n";
?>
--EXPECTF--
*** Testing get_html_translation_table() : usage variations ***
--- Testing get_html_translation_table() by supplying different values for 'table' argument ---
-- Iteration 1 --
Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
NULL
Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
NULL
-- Iteration 2 --
Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
NULL
Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
NULL
-- Iteration 3 --
Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
NULL
Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
NULL
-- Iteration 4 --
Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
NULL
Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
NULL
-- Iteration 5 --
Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
NULL
Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
NULL
-- Iteration 6 --
int(252)
int(252)
-- Iteration 7 --
array(4) {
["&"]=>
string(5) "&"
[">"]=>
string(4) ">"
["<"]=>
string(4) "<"
["""]=>
string(6) """
}
array(4) {
["&"]=>
string(5) "&"
[">"]=>
string(4) ">"
["<"]=>
string(4) "<"
["""]=>
string(6) """
}
-- Iteration 8 --
int(252)
int(252)
-- Iteration 9 --
array(4) {
["&"]=>
string(5) "&"
[">"]=>
string(4) ">"
["<"]=>
string(4) "<"
["""]=>
string(6) """
}
array(4) {
["&"]=>
string(5) "&"
[">"]=>
string(4) ">"
["<"]=>
string(4) "<"
["""]=>
string(6) """
}
-- Iteration 10 --
Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
NULL
Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
NULL
-- Iteration 11 --
Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
NULL
Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
NULL
-- Iteration 12 --
Warning: get_html_translation_table() expects parameter 1 to be long, object given in %s on line %d
NULL
Warning: get_html_translation_table() expects parameter 1 to be long, object given in %s on line %d
NULL
-- Iteration 13 --
Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
NULL
Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
NULL
-- Iteration 14 --
Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
NULL
Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
NULL
-- Iteration 15 --
array(4) {
["&"]=>
string(5) "&"
[">"]=>
string(4) ">"
["<"]=>
string(4) "<"
["""]=>
string(6) """
}
array(4) {
["&"]=>
string(5) "&"
[">"]=>
string(4) ">"
["<"]=>
string(4) "<"
["""]=>
string(6) """
}
-- Iteration 16 --
array(4) {
["&"]=>
string(5) "&"
[">"]=>
string(4) ">"
["<"]=>
string(4) "<"
["""]=>
string(6) """
}
array(4) {
["&"]=>
string(5) "&"
[">"]=>
string(4) ">"
["<"]=>
string(4) "<"
["""]=>
string(6) """
}
-- Iteration 17 --
Warning: get_html_translation_table() expects parameter 1 to be long, resource given in %s on line %d
NULL
Warning: get_html_translation_table() expects parameter 1 to be long, resource given in %s on line %d
NULL
-- Iteration 18 --
array(4) {
["&"]=>
string(5) "&"
[">"]=>
string(4) ">"
["<"]=>
string(4) "<"
["""]=>
string(6) """
}
array(4) {
["&"]=>
string(5) "&"
[">"]=>
string(4) ">"
["<"]=>
string(4) "<"
["""]=>
string(6) """
}
-- Iteration 19 --
array(4) {
["&"]=>
string(5) "&"
[">"]=>
string(4) ">"
["<"]=>
string(4) "<"
["""]=>
string(6) """
}
array(4) {
["&"]=>
string(5) "&"
[">"]=>
string(4) ">"
["<"]=>
string(4) "<"
["""]=>
string(6) """
}
Done