1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
--TEST--
html_entity_decode: Decoding of entities after invalid entities
--FILE--
<?php
$arr = array(
"&",
"&&",
"&$",
"&#&",
"&#$",
"&#x&",
"&#x$",
"&",
"$",
" &",
" $",
"&",
"$",
"&",
"$",
"&a&",
"&a$",
"&aa&",
"&aa$",
"&aa;&",
"&aa;$",
"&;&",
"&;$",
);
$i = 0;
foreach ($arr as $ent) {
if ($i % 2 == 1) {
if (($a = html_entity_decode($ent, ENT_QUOTES, 'UTF-8')) !=
($b = htmlspecialchars_decode($ent, ENT_QUOTES))) {
echo "htmlspecialchars_decode <-> html_entity_decode inconsistency","\n",
"$b <-> $a","\n";
}
}
echo html_entity_decode($ent, ENT_QUOTES, 'UTF-8'), "\n";
}
echo "Done.\n";
--EXPECT--
&
&&
&$
&#&
&#$
&#x&
&#x$
&
$
 &
 $
&
$
&
$
&a&
&a$
&aa&
&aa$
&aa;&
&aa;$
&;&
&;$
Done.
|