--TEST--
Test get_next_char(), used by htmlentities()/htmlspecialchars(): validity of UTF-8 sequences
--FILE--
= $l[0][0] && $b <= $l[0][1]) {
if (count($l) != strlen($seq)) {
return false;
}
for ($n = 1; $n < strlen($seq); $n++) {
if (ord($seq[$n]) < $l[$n][0] || ord($seq[$n]) > $l[$n][1]) {
return false;
}
}
return true;
}
}
return false;
}
function concordance($s) {
$vhe = strlen(htmlspecialchars($s, ENT_QUOTES, "UTF-8")) > 0;
$v = is_valid($s);
return ($vhe === $v);
}
for ($b1 = 0xC0; $b1 < 0xE0; $b1++) {
for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
$s = chr($b1).chr($b2);
if (!concordance($s))
echo "Discordance for ".bin2hex($s),"\n";
}
}
for ($b1 = 0xE0; $b1 < 0xEF; $b1++) {
for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
$s = chr($b1).chr($b2)."\x80";
if (!concordance($s))
echo "Discordance for ".bin2hex($s),"\n";
$s = chr($b1).chr($b2)."\xBF";
if (!concordance($s))
echo "Discordance for ".bin2hex($s),"\n";
}
}
for ($b1 = 0xF0; $b1 < 0xFF; $b1++) {
for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
$s = chr($b1).chr($b2)."\x80\x80";
if (!concordance($s))
echo "Discordance for ".bin2hex($s),"\n";
$s = chr($b1).chr($b2)."\xBF\x80";
if (!concordance($s))
echo "Discordance for ".bin2hex($s),"\n";
$s = chr($b1).chr($b2)."\x80\xBF";
if (!concordance($s))
echo "Discordance for ".bin2hex($s),"\n";
$s = chr($b1).chr($b2)."\xBF\xBF";
if (!concordance($s))
echo "Discordance for ".bin2hex($s),"\n";
}
}
echo "Done.\n";
--EXPECT--
Done.