~ubuntu-branches/ubuntu/raring/php5/raring

« back to all changes in this revision

Viewing changes to ext/standard/tests/strings/html_entity_decode3.phpt

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-18 16:10:26 UTC
  • mfrom: (1.1.24) (0.3.58 sid)
  • Revision ID: package-import@ubuntu.com-20120618161026-hg1fc5r9z1a4hlqz
Tags: 5.4.4-1ubuntu1
* Merge from Debian unstable. Remaining changes:
  - d/rules: Simplify apache config settings since we never build 
    interbase or firebird.
  - debian/rules: export DEB_HOST_MULTIARCH properly.
  - Add build-dependency on lemon, which we now need.
  - Dropped firebird2.1-dev, libc-client-dev, libmcrypt-dev as it is in universe.
  - Dropped libcurl-dev not in the archive.
  - debian/control: replace build-depends on mysql-server with
    mysql-server-core-5.5 and mysql-client-5.5 to avoid upstart and
    mysql-server-5.5 postinst confusion with starting up multiple
    mysqlds listening on the same port.
  - Dropped php5-imap, php5-interbase, php5-mcrypt since we have versions
    already in universe.
  - Dropped libonig-dev and libqgdbm since its in universe. (libonig MIR
    has been declined due to an inactive upstream. So this is probably
    a permanent change).
  - modulelist: Drop imap, interbase, sybase, and mcrypt.
  - debian/rules:
    * Dropped building of mcrypt, imap, and interbase.
    * Install apport hook for php5.
    * stop mysql instance on clean just in case we failed in tests
* Dropped Changes:
  * d/rules: enable Suhosin patch with PHP5_SUHOSIN=yes -- Upstream suhosin
    has been slow to adopt PHP 5.4, and is showing signs of disengagement.
    Therefore, we will follow Debian's lead and drop Suhosin for now.
  - d/control: build-depend on mysql 5.5 instead of 5.1 for running tests.
    -- Debian just deps on mysql-server
  - Suggest php5-suhosin rather than recommends. -- Dropping suhosin
  - d/setup-mysql.sh: modify to work with mysql 5.5 differences -- superseded
    in Debian.
  - Only build php5-sqlite for sqlite3, dropping the obsolete sqlite2. --
    superseded in Debian
  - d/maxlifetime: Improve maxlifetime script to scan for more SAPIs and 
    scan all *.ini in conf.d directory. -- Change came from Debian
  - d/libapache2-mod-php5.postinst,libapache2-mod-php5filter.postinst: 
    Restart apache on first install to ensure module is fully enabled.
    -- Change came from Debian
  - debian/patches/php5-CVE-2012-1823.patch: filter query strings that
    are prefixed with '-' -- Fixed upstream
  - debian/control: Recommend php5-dev for php-pear. -- This was a poorly
    conceived idea anyway.
  - Pre-Depend on a new enough version of dpkg for dpkg-maintscript-helper
    rather than checking whether it exists at run-time, leading to more
    predictable behaviour on upgrades. -- Applied in Debian
  - d/p/gd-multiarch-fix.patch: superseded
* d/NEWS: add note explaining that SUHOSIN is no longer enabled in the
  Ubuntu packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
html_entity_decode: Do not decode numerical entities that refer to non-SGML or otherwise disallowed chars
 
3
--FILE--
 
4
<?php
 
5
 
 
6
$tests = array(
 
7
    "&#0;", //C0
 
8
    "&#1;",
 
9
    "&#x09;",
 
10
    "&#x0A;",
 
11
    "&#x0B;",
 
12
    "&#x0C;",
 
13
    "&#x0D;", //note that HTML5 is unique in that it forbids this entity, but allows a literal U+0D
 
14
    "&#x0E;",
 
15
    "&#x1F;",
 
16
    "&#x20;", //allowed always
 
17
    "&#x7F;", //DEL
 
18
    "&#x80;", //C1
 
19
    "&#x9F;",
 
20
    "&#xA0;", //allowed always
 
21
    "&#xD7FF;", //surrogates
 
22
    "&#xD800;",
 
23
    "&#xDFFF;",
 
24
    "&#xE000;", //allowed always
 
25
    "&#xFFFE;", //nonchar
 
26
    "&#xFFFF;",
 
27
    "&#xFDCF;", //allowed always
 
28
    "&#xFDD0;", //nonchar
 
29
    "&#xFDEF;",
 
30
    "&#xFDF0;", //allowed always
 
31
    "&#x2FFFE;", //nonchar
 
32
    "&#x2FFFF;",
 
33
);
 
34
 
 
35
echo "*** HTML 4.01  ***\n";
 
36
 
 
37
foreach ($tests as $t) {
 
38
    $dec = html_entity_decode($t, ENT_QUOTES | ENT_HTML401, "UTF-8");
 
39
    if ($t == $dec) {
 
40
        echo "$t\tNOT DECODED\n";
 
41
    } else {
 
42
        echo "$t\tDECODED\n";
 
43
    }
 
44
}
 
45
 
 
46
echo "\n*** XHTML 1.0  ***\n";
 
47
 
 
48
foreach ($tests as $t) {
 
49
    $dec = html_entity_decode($t, ENT_QUOTES | ENT_XHTML, "UTF-8");
 
50
    if ($t == $dec) {
 
51
        echo "$t\tNOT DECODED\n";
 
52
    } else {
 
53
        echo "$t\tDECODED\n";
 
54
    }
 
55
}
 
56
 
 
57
echo "\n*** HTML5  ***\n";
 
58
 
 
59
foreach ($tests as $t) {
 
60
    $dec = html_entity_decode($t, ENT_QUOTES | ENT_HTML5, "UTF-8");
 
61
    if ($t == $dec) {
 
62
        echo "$t\tNOT DECODED\n";
 
63
    } else {
 
64
        echo "$t\tDECODED\n";
 
65
    }
 
66
}
 
67
 
 
68
echo "\n*** XML 1.0  ***\n";
 
69
 
 
70
foreach ($tests as $t) {
 
71
    $dec = html_entity_decode($t, ENT_QUOTES | ENT_XML1, "UTF-8");
 
72
    if ($t == $dec) {
 
73
        echo "$t\tNOT DECODED\n";
 
74
    } else {
 
75
        echo "$t\tDECODED\n";
 
76
    }
 
77
}
 
78
 
 
79
echo "\nDone.\n";
 
80
--EXPECT--
 
81
*** HTML 4.01  ***
 
82
&#0;    NOT DECODED
 
83
&#1;    NOT DECODED
 
84
&#x09;  DECODED
 
85
&#x0A;  DECODED
 
86
&#x0B;  NOT DECODED
 
87
&#x0C;  NOT DECODED
 
88
&#x0D;  DECODED
 
89
&#x0E;  NOT DECODED
 
90
&#x1F;  NOT DECODED
 
91
&#x20;  DECODED
 
92
&#x7F;  NOT DECODED
 
93
&#x80;  NOT DECODED
 
94
&#x9F;  NOT DECODED
 
95
&#xA0;  DECODED
 
96
&#xD7FF;        DECODED
 
97
&#xD800;        NOT DECODED
 
98
&#xDFFF;        NOT DECODED
 
99
&#xE000;        DECODED
 
100
&#xFFFE;        DECODED
 
101
&#xFFFF;        DECODED
 
102
&#xFDCF;        DECODED
 
103
&#xFDD0;        DECODED
 
104
&#xFDEF;        DECODED
 
105
&#xFDF0;        DECODED
 
106
&#x2FFFE;       DECODED
 
107
&#x2FFFF;       DECODED
 
108
 
 
109
*** XHTML 1.0  ***
 
110
&#0;    NOT DECODED
 
111
&#1;    NOT DECODED
 
112
&#x09;  DECODED
 
113
&#x0A;  DECODED
 
114
&#x0B;  NOT DECODED
 
115
&#x0C;  NOT DECODED
 
116
&#x0D;  DECODED
 
117
&#x0E;  NOT DECODED
 
118
&#x1F;  NOT DECODED
 
119
&#x20;  DECODED
 
120
&#x7F;  DECODED
 
121
&#x80;  DECODED
 
122
&#x9F;  DECODED
 
123
&#xA0;  DECODED
 
124
&#xD7FF;        DECODED
 
125
&#xD800;        NOT DECODED
 
126
&#xDFFF;        NOT DECODED
 
127
&#xE000;        DECODED
 
128
&#xFFFE;        NOT DECODED
 
129
&#xFFFF;        NOT DECODED
 
130
&#xFDCF;        DECODED
 
131
&#xFDD0;        DECODED
 
132
&#xFDEF;        DECODED
 
133
&#xFDF0;        DECODED
 
134
&#x2FFFE;       DECODED
 
135
&#x2FFFF;       DECODED
 
136
 
 
137
*** HTML5  ***
 
138
&#0;    NOT DECODED
 
139
&#1;    NOT DECODED
 
140
&#x09;  DECODED
 
141
&#x0A;  DECODED
 
142
&#x0B;  NOT DECODED
 
143
&#x0C;  DECODED
 
144
&#x0D;  NOT DECODED
 
145
&#x0E;  NOT DECODED
 
146
&#x1F;  NOT DECODED
 
147
&#x20;  DECODED
 
148
&#x7F;  NOT DECODED
 
149
&#x80;  NOT DECODED
 
150
&#x9F;  NOT DECODED
 
151
&#xA0;  DECODED
 
152
&#xD7FF;        DECODED
 
153
&#xD800;        NOT DECODED
 
154
&#xDFFF;        NOT DECODED
 
155
&#xE000;        DECODED
 
156
&#xFFFE;        NOT DECODED
 
157
&#xFFFF;        NOT DECODED
 
158
&#xFDCF;        DECODED
 
159
&#xFDD0;        NOT DECODED
 
160
&#xFDEF;        NOT DECODED
 
161
&#xFDF0;        DECODED
 
162
&#x2FFFE;       NOT DECODED
 
163
&#x2FFFF;       NOT DECODED
 
164
 
 
165
*** XML 1.0  ***
 
166
&#0;    NOT DECODED
 
167
&#1;    NOT DECODED
 
168
&#x09;  DECODED
 
169
&#x0A;  DECODED
 
170
&#x0B;  NOT DECODED
 
171
&#x0C;  NOT DECODED
 
172
&#x0D;  DECODED
 
173
&#x0E;  NOT DECODED
 
174
&#x1F;  NOT DECODED
 
175
&#x20;  DECODED
 
176
&#x7F;  DECODED
 
177
&#x80;  DECODED
 
178
&#x9F;  DECODED
 
179
&#xA0;  DECODED
 
180
&#xD7FF;        DECODED
 
181
&#xD800;        NOT DECODED
 
182
&#xDFFF;        NOT DECODED
 
183
&#xE000;        DECODED
 
184
&#xFFFE;        NOT DECODED
 
185
&#xFFFF;        NOT DECODED
 
186
&#xFDCF;        DECODED
 
187
&#xFDD0;        DECODED
 
188
&#xFDEF;        DECODED
 
189
&#xFDF0;        DECODED
 
190
&#x2FFFE;       DECODED
 
191
&#x2FFFF;       DECODED
 
192
 
 
193
Done.