File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
strings /
htmlentities22.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--
htmlentities() / htmlspecialchars() ENT_DISALLOWED with entities and no double encode
--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
"",
"�", //bad reference
);
function test($flag, $flag2=ENT_DISALLOWED, $charset="UTF-8") {
global $tests;
$i = -1;
error_reporting(-1 & ~E_STRICT);
foreach ($tests as $test) {
$i++;
$a = htmlentities($test, $flag | $flag2, $charset, FALSE);
$b = htmlspecialchars($test, $flag | $flag2, $charset, FALSE);
if ($a == $b)
echo sprintf("%s\t%s", $test, $a==$test?"NOT CHANGED":"CHANGED"), "\n";
else
echo sprintf("%s\tCHANGED (%s, %s)", $test, $a, $b), "\n";
}
error_reporting(-1);
}
echo "*** Testing HTML 4.01 ***\n";
test(ENT_HTML401);
echo "\n*** Testing XHTML 1.0 ***\n";
test(ENT_XHTML);
echo "\n*** Testing HTML 5 ***\n";
test(ENT_HTML5);
echo "\n*** Testing XML 1.0 ***\n";
test(ENT_XML1);
echo "\n*** Testing 5 without the flag ***\n";
test(ENT_HTML5, 0);
echo "\n*** Testing HTML 5 with another single-byte encoding ***\n";
test(ENT_HTML5, ENT_DISALLOWED, "Windows-1251");
echo "\n*** Testing HTML 5 with another multibyte-byte encoding ***\n";
test(ENT_HTML5, ENT_DISALLOWED, "SJIS");
?>
--EXPECT--
*** Testing HTML 4.01 ***
� NOT CHANGED
 NOT CHANGED
	 NOT CHANGED

 NOT CHANGED
 NOT CHANGED
 NOT CHANGED

 NOT CHANGED
 NOT CHANGED
 NOT CHANGED
  NOT CHANGED
 NOT CHANGED
€ NOT CHANGED
Ÿ NOT CHANGED
  NOT CHANGED
퟿ NOT CHANGED
� NOT CHANGED
� NOT CHANGED
 NOT CHANGED
 NOT CHANGED
 NOT CHANGED
﷏ NOT CHANGED
 NOT CHANGED
 NOT CHANGED
ﷰ NOT CHANGED
 NOT CHANGED
 NOT CHANGED
� CHANGED
*** Testing XHTML 1.0 ***
� CHANGED
 CHANGED
	 NOT CHANGED

 NOT CHANGED
 CHANGED
 CHANGED

 NOT CHANGED
 CHANGED
 CHANGED
  NOT CHANGED
 NOT CHANGED
€ NOT CHANGED
Ÿ NOT CHANGED
  NOT CHANGED
퟿ NOT CHANGED
� CHANGED
� CHANGED
 NOT CHANGED
 CHANGED
 CHANGED
﷏ NOT CHANGED
 NOT CHANGED
 NOT CHANGED
ﷰ NOT CHANGED
 NOT CHANGED
 NOT CHANGED
� CHANGED
*** Testing HTML 5 ***
� CHANGED (&#0;, &#0;)
 CHANGED (&#1;, &#1;)
	 NOT CHANGED

 NOT CHANGED
 CHANGED (&#x0B;, &#x0B;)
 NOT CHANGED

 CHANGED (&#x0D;, &#x0D;)
 CHANGED (&#x0E;, &#x0E;)
 CHANGED (&#x1F;, &#x1F;)
  NOT CHANGED
 CHANGED (&#x7F;, &#x7F;)
€ CHANGED (&#x80;, &#x80;)
Ÿ CHANGED (&#x9F;, &#x9F;)
  NOT CHANGED
퟿ NOT CHANGED
� NOT CHANGED
� NOT CHANGED
 NOT CHANGED
 CHANGED (&#xFFFE;, &#xFFFE;)
 CHANGED (&#xFFFF;, &#xFFFF;)
﷏ NOT CHANGED
 CHANGED (&#xFDD0;, &#xFDD0;)
 CHANGED (&#xFDEF;, &#xFDEF;)
ﷰ NOT CHANGED
 CHANGED (&#x2FFFE;, &#x2FFFE;)
 CHANGED (&#x2FFFF;, &#x2FFFF;)
� CHANGED (&#x110000;, &#x110000;)
*** Testing XML 1.0 ***
� CHANGED
 CHANGED
	 NOT CHANGED

 NOT CHANGED
 CHANGED
 CHANGED

 NOT CHANGED
 CHANGED
 CHANGED
  NOT CHANGED
 NOT CHANGED
€ NOT CHANGED
Ÿ NOT CHANGED
  NOT CHANGED
퟿ NOT CHANGED
� CHANGED
� CHANGED
 NOT CHANGED
 CHANGED
 CHANGED
﷏ NOT CHANGED
 NOT CHANGED
 NOT CHANGED
ﷰ NOT CHANGED
 NOT CHANGED
 NOT CHANGED
� CHANGED
*** Testing 5 without the flag ***
� NOT CHANGED
 NOT CHANGED
	 NOT CHANGED

 NOT CHANGED
 NOT CHANGED
 NOT CHANGED

 NOT CHANGED
 NOT CHANGED
 NOT CHANGED
  NOT CHANGED
 NOT CHANGED
€ NOT CHANGED
Ÿ NOT CHANGED
  NOT CHANGED
퟿ NOT CHANGED
� NOT CHANGED
� NOT CHANGED
 NOT CHANGED
 NOT CHANGED
 NOT CHANGED
﷏ NOT CHANGED
 NOT CHANGED
 NOT CHANGED
ﷰ NOT CHANGED
 NOT CHANGED
 NOT CHANGED
� CHANGED (&#x110000;, &#x110000;)
*** Testing HTML 5 with another single-byte encoding ***
� CHANGED (&#0;, &#0;)
 CHANGED (&#1;, &#1;)
	 NOT CHANGED

 NOT CHANGED
 CHANGED (&#x0B;, &#x0B;)
 NOT CHANGED

 CHANGED (&#x0D;, &#x0D;)
 CHANGED (&#x0E;, &#x0E;)
 CHANGED (&#x1F;, &#x1F;)
  NOT CHANGED
 CHANGED (&#x7F;, &#x7F;)
€ CHANGED (&#x80;, &#x80;)
Ÿ CHANGED (&#x9F;, &#x9F;)
  NOT CHANGED
퟿ NOT CHANGED
� NOT CHANGED
� NOT CHANGED
 NOT CHANGED
 CHANGED (&#xFFFE;, &#xFFFE;)
 CHANGED (&#xFFFF;, &#xFFFF;)
﷏ NOT CHANGED
 CHANGED (&#xFDD0;, &#xFDD0;)
 CHANGED (&#xFDEF;, &#xFDEF;)
ﷰ NOT CHANGED
 CHANGED (&#x2FFFE;, &#x2FFFE;)
 CHANGED (&#x2FFFF;, &#x2FFFF;)
� CHANGED (&#x110000;, &#x110000;)
*** Testing HTML 5 with another multibyte-byte encoding ***
� CHANGED
 CHANGED
	 NOT CHANGED

 NOT CHANGED
 CHANGED
 NOT CHANGED

 CHANGED
 CHANGED
 CHANGED
  NOT CHANGED
 CHANGED
€ CHANGED
Ÿ CHANGED
  NOT CHANGED
퟿ NOT CHANGED
� NOT CHANGED
� NOT CHANGED
 NOT CHANGED
 CHANGED
 CHANGED
﷏ NOT CHANGED
 CHANGED
 CHANGED
ﷰ NOT CHANGED
 CHANGED
 CHANGED
� CHANGED
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>