File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
strings /
htmlspecialchars_decode_variation7.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--
Test htmlspecialchars_decode() function : usage variations - numerical entities for basic characters
--FILE--
<?php
$tests = array(
""", """, """,
"'", "'", "'",
"&", "&", "<",
">", "<", "<",
"<", ">", ">",
"?"
);
echo "*** HTML 4.01/ENT_QUOTES ***\n";
foreach ($tests as $t) {
$dec = htmlspecialchars_decode($t, ENT_QUOTES | ENT_HTML401);
if ($t == $dec) {
echo "$t\tNOT DECODED\n";
} else {
echo "$t\tDECODED\n";
}
}
echo "\n*** XHTML 1.0/ENT_QUOTES ***\n";
foreach ($tests as $t) {
$dec = htmlspecialchars_decode($t, ENT_QUOTES | ENT_XHTML);
if ($t == $dec) {
echo "$t\tNOT DECODED\n";
} else {
echo "$t\tDECODED\n";
}
}
echo "\n*** HTML5/ENT_QUOTES ***\n";
foreach ($tests as $t) {
$dec = htmlspecialchars_decode($t, ENT_QUOTES | ENT_HTML5);
if ($t == $dec) {
echo "$t\tNOT DECODED\n";
} else {
echo "$t\tDECODED\n";
}
}
echo "\n*** XML 1.0/ENT_QUOTES ***\n";
foreach ($tests as $t) {
$dec = htmlspecialchars_decode($t, ENT_QUOTES | ENT_XML1);
if ($t == $dec) {
echo "$t\tNOT DECODED\n";
} else {
echo "$t\tDECODED\n";
}
}
echo "\n*** HTML5/ENT_NOQUOTES ***\n";
foreach ($tests as $t) {
$dec = htmlspecialchars_decode($t, ENT_NOQUOTES | ENT_HTML5);
if ($t == $dec) {
echo "$t\tNOT DECODED\n";
} else {
echo "$t\tDECODED\n";
}
}
echo "\n*** HTML5/ENT_COMPAT ***\n";
foreach ($tests as $t) {
$dec = htmlspecialchars_decode($t, ENT_COMPAT | ENT_HTML5);
if ($t == $dec) {
echo "$t\tNOT DECODED\n";
} else {
echo "$t\tDECODED\n";
}
}
echo "\nDone.\n";
?>
--EXPECT--
*** HTML 4.01/ENT_QUOTES ***
" DECODED
" DECODED
" DECODED
' NOT DECODED
' DECODED
' DECODED
& DECODED
& DECODED
< DECODED
> DECODED
< DECODED
< DECODED
< DECODED
> DECODED
> DECODED
? NOT DECODED
*** XHTML 1.0/ENT_QUOTES ***
" DECODED
" DECODED
" DECODED
' DECODED
' DECODED
' DECODED
& DECODED
& DECODED
< DECODED
> DECODED
< DECODED
< DECODED
< DECODED
> DECODED
> DECODED
? NOT DECODED
*** HTML5/ENT_QUOTES ***
" DECODED
" DECODED
" DECODED
' DECODED
' DECODED
' DECODED
& DECODED
& DECODED
< DECODED
> DECODED
< DECODED
< DECODED
< DECODED
> DECODED
> DECODED
? NOT DECODED
*** XML 1.0/ENT_QUOTES ***
" DECODED
" DECODED
" DECODED
' DECODED
' DECODED
' DECODED
& DECODED
& DECODED
< DECODED
> DECODED
< DECODED
< DECODED
< DECODED
> DECODED
> DECODED
? NOT DECODED
*** HTML5/ENT_NOQUOTES ***
" NOT DECODED
" NOT DECODED
" NOT DECODED
' NOT DECODED
' NOT DECODED
' NOT DECODED
& DECODED
& DECODED
< DECODED
> DECODED
< DECODED
< DECODED
< DECODED
> DECODED
> DECODED
? NOT DECODED
*** HTML5/ENT_COMPAT ***
" DECODED
" DECODED
" DECODED
' NOT DECODED
' NOT DECODED
' NOT DECODED
& DECODED
& DECODED
< DECODED
> DECODED
< DECODED
< DECODED
< DECODED
> DECODED
> DECODED
? NOT DECODED
Done.
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>