mirror of
https://github.com/php/php-src.git
synced 2024-09-27 21:07:25 +00:00
67 lines
1015 B
Plaintext
67 lines
1015 B
Plaintext
|
--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.
|