mirror of
https://github.com/php/php-src.git
synced 2024-10-01 06:46:08 +00:00
194 lines
3.6 KiB
Plaintext
194 lines
3.6 KiB
Plaintext
|
--TEST--
|
||
|
html_entity_decode: Do not decode numerical entities that refer to non-SGML or otherwise disallowed chars
|
||
|
--FILE--
|
||
|
<?php
|
||
|
|
||
|
$tests = array(
|
||
|
"�", //C0
|
||
|
"",
|
||
|
"	",
|
||
|
"
",
|
||
|
"",
|
||
|
"",
|
||
|
"
", //note that HTML5 is unique in that it forbids this entity, but allows a literal U+0D
|
||
|
"",
|
||
|
"",
|
||
|
" ", //allowed always
|
||
|
"", //DEL
|
||
|
"€", //C1
|
||
|
"Ÿ",
|
||
|
" ", //allowed always
|
||
|
"퟿", //surrogates
|
||
|
"�",
|
||
|
"�",
|
||
|
"", //allowed always
|
||
|
"", //nonchar
|
||
|
"",
|
||
|
"﷏", //allowed always
|
||
|
"", //nonchar
|
||
|
"",
|
||
|
"ﷰ", //allowed always
|
||
|
"", //nonchar
|
||
|
"",
|
||
|
);
|
||
|
|
||
|
echo "*** HTML 4.01 ***\n";
|
||
|
|
||
|
foreach ($tests as $t) {
|
||
|
$dec = html_entity_decode($t, ENT_QUOTES | ENT_HTML401, "UTF-8");
|
||
|
if ($t == $dec) {
|
||
|
echo "$t\tNOT DECODED\n";
|
||
|
} else {
|
||
|
echo "$t\tDECODED\n";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
echo "\n*** XHTML 1.0 ***\n";
|
||
|
|
||
|
foreach ($tests as $t) {
|
||
|
$dec = html_entity_decode($t, ENT_QUOTES | ENT_XHTML, "UTF-8");
|
||
|
if ($t == $dec) {
|
||
|
echo "$t\tNOT DECODED\n";
|
||
|
} else {
|
||
|
echo "$t\tDECODED\n";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
echo "\n*** HTML5 ***\n";
|
||
|
|
||
|
foreach ($tests as $t) {
|
||
|
$dec = html_entity_decode($t, ENT_QUOTES | ENT_HTML5, "UTF-8");
|
||
|
if ($t == $dec) {
|
||
|
echo "$t\tNOT DECODED\n";
|
||
|
} else {
|
||
|
echo "$t\tDECODED\n";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
echo "\n*** XML 1.0 ***\n";
|
||
|
|
||
|
foreach ($tests as $t) {
|
||
|
$dec = html_entity_decode($t, ENT_QUOTES | ENT_XML1, "UTF-8");
|
||
|
if ($t == $dec) {
|
||
|
echo "$t\tNOT DECODED\n";
|
||
|
} else {
|
||
|
echo "$t\tDECODED\n";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
echo "\nDone.\n";
|
||
|
--EXPECT--
|
||
|
*** HTML 4.01 ***
|
||
|
� NOT DECODED
|
||
|
 NOT DECODED
|
||
|
	 DECODED
|
||
|

 DECODED
|
||
|
 NOT DECODED
|
||
|
 NOT DECODED
|
||
|

 DECODED
|
||
|
 NOT DECODED
|
||
|
 NOT DECODED
|
||
|
  DECODED
|
||
|
 NOT DECODED
|
||
|
€ NOT DECODED
|
||
|
Ÿ NOT DECODED
|
||
|
  DECODED
|
||
|
퟿ DECODED
|
||
|
� NOT DECODED
|
||
|
� NOT DECODED
|
||
|
 DECODED
|
||
|
 DECODED
|
||
|
 DECODED
|
||
|
﷏ DECODED
|
||
|
 DECODED
|
||
|
 DECODED
|
||
|
ﷰ DECODED
|
||
|
 DECODED
|
||
|
 DECODED
|
||
|
|
||
|
*** XHTML 1.0 ***
|
||
|
� NOT DECODED
|
||
|
 NOT DECODED
|
||
|
	 DECODED
|
||
|

 DECODED
|
||
|
 NOT DECODED
|
||
|
 NOT DECODED
|
||
|

 DECODED
|
||
|
 NOT DECODED
|
||
|
 NOT DECODED
|
||
|
  DECODED
|
||
|
 DECODED
|
||
|
€ DECODED
|
||
|
Ÿ DECODED
|
||
|
  DECODED
|
||
|
퟿ DECODED
|
||
|
� NOT DECODED
|
||
|
� NOT DECODED
|
||
|
 DECODED
|
||
|
 NOT DECODED
|
||
|
 NOT DECODED
|
||
|
﷏ DECODED
|
||
|
 DECODED
|
||
|
 DECODED
|
||
|
ﷰ DECODED
|
||
|
 DECODED
|
||
|
 DECODED
|
||
|
|
||
|
*** HTML5 ***
|
||
|
� NOT DECODED
|
||
|
 NOT DECODED
|
||
|
	 DECODED
|
||
|

 DECODED
|
||
|
 NOT DECODED
|
||
|
 DECODED
|
||
|

 NOT DECODED
|
||
|
 NOT DECODED
|
||
|
 NOT DECODED
|
||
|
  DECODED
|
||
|
 NOT DECODED
|
||
|
€ NOT DECODED
|
||
|
Ÿ NOT DECODED
|
||
|
  DECODED
|
||
|
퟿ DECODED
|
||
|
� NOT DECODED
|
||
|
� NOT DECODED
|
||
|
 DECODED
|
||
|
 NOT DECODED
|
||
|
 NOT DECODED
|
||
|
﷏ DECODED
|
||
|
 NOT DECODED
|
||
|
 NOT DECODED
|
||
|
ﷰ DECODED
|
||
|
 NOT DECODED
|
||
|
 NOT DECODED
|
||
|
|
||
|
*** XML 1.0 ***
|
||
|
� NOT DECODED
|
||
|
 NOT DECODED
|
||
|
	 DECODED
|
||
|

 DECODED
|
||
|
 NOT DECODED
|
||
|
 NOT DECODED
|
||
|

 DECODED
|
||
|
 NOT DECODED
|
||
|
 NOT DECODED
|
||
|
  DECODED
|
||
|
 DECODED
|
||
|
€ DECODED
|
||
|
Ÿ DECODED
|
||
|
  DECODED
|
||
|
퟿ DECODED
|
||
|
� NOT DECODED
|
||
|
� NOT DECODED
|
||
|
 DECODED
|
||
|
 NOT DECODED
|
||
|
 NOT DECODED
|
||
|
﷏ DECODED
|
||
|
 DECODED
|
||
|
 DECODED
|
||
|
ﷰ DECODED
|
||
|
 DECODED
|
||
|
 DECODED
|
||
|
|
||
|
Done.
|