File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
strings /
html_entity_decode3.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue May 29 12:34:45 2012 UTC (12 years, 2 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
HEAD
php 5.4.3+patches
--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.
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>