reference/filter/filters.xml
53054bf8decc8648cf2e90a493692a161e2371af
...
...
@@ -1,822 +0,0 @@
1
-
<?xml version="1.0" encoding="utf-8"?>
2
-
<!-- $Revision$ -->
3
-
<chapter xml:id="filter.filters" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
4
-
<title>Types of filters</title>
5
-

6
-
<!--Validate filters: {{{-->
7
-
<section xml:id="filter.filters.validate">
8
-
<title>Validate filters</title>
9
-
<para>
10
-
<table>
11
-
<title>Listing of filters for validation</title>
12
-
<tgroup cols="5">
13
-
<thead>
14
-
<row>
15
-
<entry>ID</entry>
16
-
<entry>Name</entry>
17
-
<entry>Options</entry>
18
-
<entry>Flags</entry>
19
-
<entry>Description</entry>
20
-
</row>
21
-
</thead>
22
-
<tbody>
23
-
<row>
24
-
<entry>
25
-
<constant>FILTER_VALIDATE_BOOLEAN</constant>,
26
-
<constant>FILTER_VALIDATE_BOOL</constant>
27
-
</entry>
28
-
<entry>"boolean"</entry>
29
-
<entry>
30
-
<parameter>default</parameter>
31
-
</entry>
32
-
<entry>
33
-
<constant>FILTER_NULL_ON_FAILURE</constant>
34
-
</entry>
35
-
<entry>
36
-
<para>
37
-
Returns &true; for "1", "true", "on" and "yes".
38
-
Returns &false; otherwise.
39
-
</para>
40
-
<para>
41
-
If <constant>FILTER_NULL_ON_FAILURE</constant> is set, &false; is
42
-
returned only for "0", "false", "off", "no", and "", and
43
-
&null; is returned for all non-boolean values.
44
-
</para>
45
-
</entry>
46
-
</row>
47
-
<row>
48
-
<entry><constant>FILTER_VALIDATE_DOMAIN</constant></entry>
49
-
<entry>"validate_domain"</entry>
50
-
<entry>
51
-
<parameter>default</parameter>
52
-
</entry>
53
-
<entry>
54
-
<constant>FILTER_FLAG_HOSTNAME</constant>,
55
-
<constant>FILTER_NULL_ON_FAILURE</constant>
56
-
</entry>
57
-
<entry>
58
-
<para>
59
-
Validates whether the domain name label lengths are valid.
60
-
</para>
61
-
<para>
62
-
Validates domain names against RFC 1034, RFC 1035, RFC 952,
63
-
RFC 1123, RFC 2732, RFC 2181, and RFC 1123. Optional flag
64
-
<constant>FILTER_FLAG_HOSTNAME</constant> adds ability to
65
-
specifically validate hostnames (they must start with an
66
-
alphanumeric character and contain only alphanumerics or
67
-
hyphens).
68
-
</para>
69
-
</entry>
70
-
</row>
71
-
<row>
72
-
<entry><constant>FILTER_VALIDATE_EMAIL</constant></entry>
73
-
<entry>"validate_email"</entry>
74
-
<entry>
75
-
<parameter>default</parameter>
76
-
</entry>
77
-
<entry>
78
-
<constant>FILTER_FLAG_EMAIL_UNICODE</constant>,
79
-
<constant>FILTER_NULL_ON_FAILURE</constant>
80
-
</entry>
81
-
<entry>
82
-
<para>
83
-
Validates whether the value is a valid e-mail address.
84
-
</para>
85
-
<para>
86
-
In general, this validates e-mail addresses against the <literal>addr-spec</literal>syntax in
87
-
<link xlink:href="&url.rfc;822">RFC 822</link>, with the exceptions that comments and whitespace folding
88
-
and dotless domain names
89
-
are not supported.
90
-
</para>
91
-
</entry>
92
-
</row>
93
-
<row>
94
-
<entry><constant>FILTER_VALIDATE_FLOAT</constant></entry>
95
-
<entry>"float"</entry>
96
-
<entry>
97
-
<parameter>default</parameter>,
98
-
<parameter>decimal</parameter>,
99
-
<parameter>min_range</parameter>,
100
-
<parameter>max_range</parameter>
101
-
</entry>
102
-
<entry>
103
-
<constant>FILTER_FLAG_ALLOW_THOUSAND</constant>,
104
-
<constant>FILTER_NULL_ON_FAILURE</constant>
105
-
</entry>
106
-
<entry>Validates value as float, optionally from the specified range, and converts to float on success.</entry>
107
-
</row>
108
-
<row>
109
-
<entry><constant>FILTER_VALIDATE_INT</constant></entry>
110
-
<entry>"int"</entry>
111
-
<entry>
112
-
<parameter>default</parameter>,
113
-
<parameter>min_range</parameter>,
114
-
<parameter>max_range</parameter>
115
-
</entry>
116
-
<entry>
117
-
<constant>FILTER_FLAG_ALLOW_OCTAL</constant>,
118
-
<constant>FILTER_FLAG_ALLOW_HEX</constant>,
119
-
<constant>FILTER_NULL_ON_FAILURE</constant>
120
-
</entry>
121
-
<entry>Validates value as integer, optionally from the specified range, and converts to int on success.</entry>
122
-
</row>
123
-
<row>
124
-
<entry><constant>FILTER_VALIDATE_IP</constant></entry>
125
-
<entry>"validate_ip"</entry>
126
-
<entry>
127
-
<parameter>default</parameter>
128
-
</entry>
129
-
<entry>
130
-
<constant>FILTER_FLAG_IPV4</constant>,
131
-
<constant>FILTER_FLAG_IPV6</constant>,
132
-
<constant>FILTER_FLAG_NO_PRIV_RANGE</constant>,
133
-
<constant>FILTER_FLAG_NO_RES_RANGE</constant>,
134
-
<constant>FILTER_NULL_ON_FAILURE</constant>
135
-
</entry>
136
-
<entry>
137
-
Validates value as IP address, optionally only IPv4 or IPv6 or not
138
-
from private or reserved ranges.
139
-
</entry>
140
-
</row>
141
-
<row>
142
-
<entry><constant>FILTER_VALIDATE_MAC</constant></entry>
143
-
<entry>"validate_mac_address"</entry>
144
-
<entry>
145
-
<parameter>default</parameter>
146
-
</entry>
147
-
<entry>
148
-
<constant>FILTER_NULL_ON_FAILURE</constant>
149
-
</entry>
150
-
<entry>Validates value as MAC address.</entry>
151
-
</row>
152
-
<row>
153
-
<entry><constant>FILTER_VALIDATE_REGEXP</constant></entry>
154
-
<entry>"validate_regexp"</entry>
155
-
<entry>
156
-
<parameter>default</parameter>,
157
-
<parameter>regexp</parameter>
158
-
</entry>
159
-
<entry>
160
-
<constant>FILTER_NULL_ON_FAILURE</constant>
161
-
</entry>
162
-
<entry>
163
-
Validates value against <parameter>regexp</parameter>, a
164
-
<link linkend="book.pcre">Perl-compatible</link> regular expression.
165
-
</entry>
166
-
</row>
167
-
<row>
168
-
<entry><constant>FILTER_VALIDATE_URL</constant></entry>
169
-
<entry>"validate_url"</entry>
170
-
<entry>
171
-
<parameter>default</parameter>
172
-
</entry>
173
-
<entry>
174
-
<constant>FILTER_FLAG_SCHEME_REQUIRED</constant>,
175
-
<constant>FILTER_FLAG_HOST_REQUIRED</constant>,
176
-
<constant>FILTER_FLAG_PATH_REQUIRED</constant>,
177
-
<constant>FILTER_FLAG_QUERY_REQUIRED</constant>,
178
-
<constant>FILTER_NULL_ON_FAILURE</constant>
179
-
</entry>
180
-
<entry>Validates value as URL (according to <link xlink:href="&url.rfc;2396">&url.rfc;2396</link>), optionally with required components. Beware a valid URL may not specify the HTTP protocol <literal>http://</literal> so further validation may be required to determine the URL uses an expected protocol, e.g. <literal>ssh://</literal> or <literal>mailto:</literal>. Note that the function will only find ASCII URLs to be valid; internationalized domain names (containing non-ASCII characters) will fail.</entry>
181
-
</row>
182
-
</tbody>
183
-
</tgroup>
184
-
</table>
185
-
</para>
186
-
<note>
187
-
<para>
188
-
When <parameter>default</parameter> is set to option,
189
-
<parameter>default</parameter>'s value is used if value is not validated.
190
-
</para>
191
-
</note>
192
-

193
-
<simplesect role="changelog">
194
-
&reftitle.changelog;
195
-
<para>
196
-
<informaltable>
197
-
<tgroup cols="2">
198
-
<thead>
199
-
<row>
200
-
<entry>&Version;</entry>
201
-
<entry>&Description;</entry>
202
-
</row>
203
-
</thead>
204
-
<tbody>
205
-
<row>
206
-
<entry>8.0.0</entry>
207
-
<entry>
208
-
Added <constant>FILTER_VALIDATE_BOOL</constant> as an alias for <constant>FILTER_VALIDATE_BOOLEAN</constant>.
209
-
Using <constant>FILTER_VALIDATE_BOOL</constant> is preferred.
210
-
</entry>
211
-
</row>
212
-
<row>
213
-
<entry>7.4.0</entry>
214
-
<entry>
215
-
Added <parameter>min_range</parameter> and <parameter>max_range</parameter>
216
-
options for <constant>FILTER_VALIDATE_FLOAT</constant>.
217
-
</entry>
218
-
</row>
219
-
<row>
220
-
<entry>7.0.0</entry>
221
-
<entry>
222
-
Added <constant>FILTER_FLAG_HOSTNAME</constant> and <constant>FILTER_VALIDATE_DOMAIN</constant>.
223
-
</entry>
224
-
</row>
225
-
</tbody>
226
-
</tgroup>
227
-
</informaltable>
228
-
</para>
229
-
</simplesect>
230
-

231
-
</section>
232
-
<!--}}}-->
233
-

234
-
<!-- Sanitize filters: {{{-->
235
-
<section xml:id="filter.filters.sanitize">
236
-
<title>Sanitize filters</title>
237
-
<para>
238
-
<table>
239
-
<title>List of filters for sanitization</title>
240
-
<tgroup cols="5">
241
-
<thead>
242
-
<row>
243
-
<entry>ID</entry>
244
-
<entry>Name</entry>
245
-
<entry>Flags</entry>
246
-
<entry>Description</entry>
247
-
</row>
248
-
</thead>
249
-
<tbody>
250
-
<row>
251
-
<entry><constant>FILTER_SANITIZE_EMAIL</constant></entry>
252
-
<entry>"email"</entry>
253
-
<entry></entry>
254
-
<entry>
255
-
Remove all characters except letters, digits and
256
-
<literal>!#$%&amp;'*+-=?^_`{|}~@.[]</literal>.
257
-
</entry>
258
-
</row>
259
-
<row>
260
-
<entry><constant>FILTER_SANITIZE_ENCODED</constant></entry>
261
-
<entry>"encoded"</entry>
262
-
<entry>
263
-
<constant>FILTER_FLAG_STRIP_LOW</constant>,
264
-
<constant>FILTER_FLAG_STRIP_HIGH</constant>,
265
-
<constant>FILTER_FLAG_STRIP_BACKTICK</constant>,
266
-
<constant>FILTER_FLAG_ENCODE_LOW</constant>,
267
-
<constant>FILTER_FLAG_ENCODE_HIGH</constant>
268
-
</entry>
269
-
<entry>URL-encode string, optionally strip or encode special characters.</entry>
270
-
</row>
271
-
<row>
272
-
<entry><constant>FILTER_SANITIZE_MAGIC_QUOTES</constant></entry>
273
-
<entry>"magic_quotes"</entry>
274
-
<entry></entry>
275
-
<entry>
276
-
Apply <function>addslashes</function>.
277
-
(<emphasis>DEPRECATED</emphasis> as of PHP 7.3.0 and
278
-
<emphasis>REMOVED</emphasis> as of PHP 8.0.0,
279
-
use <constant>FILTER_SANITIZE_ADD_SLASHES</constant> instead.)
280
-
</entry>
281
-
</row>
282
-
<row>
283
-
<entry><constant>FILTER_SANITIZE_ADD_SLASHES</constant></entry>
284
-
<entry>"add_slashes"</entry>
285
-
<entry></entry>
286
-
<entry>Apply <function>addslashes</function>. (Available as of PHP 7.3.0)</entry>
287
-
</row>
288
-
<row>
289
-
<entry><constant>FILTER_SANITIZE_NUMBER_FLOAT</constant></entry>
290
-
<entry>"number_float"</entry>
291
-
<entry>
292
-
<constant>FILTER_FLAG_ALLOW_FRACTION</constant>,
293
-
<constant>FILTER_FLAG_ALLOW_THOUSAND</constant>,
294
-
<constant>FILTER_FLAG_ALLOW_SCIENTIFIC</constant>
295
-
</entry>
296
-
<entry>
297
-
Remove all characters except digits, <literal>+-</literal> and
298
-
optionally <literal>.,eE</literal>.
299
-
</entry>
300
-
</row>
301
-
<row>
302
-
<entry><constant>FILTER_SANITIZE_NUMBER_INT</constant></entry>
303
-
<entry>"number_int"</entry>
304
-
<entry></entry>
305
-
<entry>
306
-
Remove all characters except digits, plus and minus sign.
307
-
</entry>
308
-
</row>
309
-
<row>
310
-
<entry><constant>FILTER_SANITIZE_SPECIAL_CHARS</constant></entry>
311
-
<entry>"special_chars"</entry>
312
-
<entry>
313
-
<constant>FILTER_FLAG_STRIP_LOW</constant>,
314
-
<constant>FILTER_FLAG_STRIP_HIGH</constant>,
315
-
<constant>FILTER_FLAG_STRIP_BACKTICK</constant>,
316
-
<constant>FILTER_FLAG_ENCODE_HIGH</constant>
317
-
</entry>
318
-
<entry>
319
-
HTML-encode <literal>'"&lt;&gt;&amp;</literal> and characters with
320
-
ASCII value less than 32, optionally strip or encode other special
321
-
characters.
322
-
</entry>
323
-
</row>
324
-
<row>
325
-
<entry><constant>FILTER_SANITIZE_FULL_SPECIAL_CHARS</constant></entry>
326
-
<entry>"full_special_chars"</entry>
327
-
<entry>
328
-
<constant>FILTER_FLAG_NO_ENCODE_QUOTES</constant>,
329
-
</entry>
330
-
<entry>
331
-
Equivalent to calling <function>htmlspecialchars</function> with <constant>ENT_QUOTES</constant> set. Encoding quotes can
332
-
be disabled by setting <constant>FILTER_FLAG_NO_ENCODE_QUOTES</constant>. Like <function>htmlspecialchars</function>, this
333
-
filter is aware of the <link linkend="ini.default-charset">default_charset</link> and if a sequence of bytes is detected that
334
-
makes up an invalid character in the current character set then the entire string is rejected resulting in a 0-length string.
335
-
When using this filter as a default filter, see the warning below about setting the default flags to 0.
336
-
</entry>
337
-
</row>
338
-
<row>
339
-
<entry><constant>FILTER_SANITIZE_STRING</constant></entry>
340
-
<entry>"string"</entry>
341
-
<entry>
342
-
<constant>FILTER_FLAG_NO_ENCODE_QUOTES</constant>,
343
-
<constant>FILTER_FLAG_STRIP_LOW</constant>,
344
-
<constant>FILTER_FLAG_STRIP_HIGH</constant>,
345
-
<constant>FILTER_FLAG_STRIP_BACKTICK</constant>,
346
-
<constant>FILTER_FLAG_ENCODE_LOW</constant>,
347
-
<constant>FILTER_FLAG_ENCODE_HIGH</constant>,
348
-
<constant>FILTER_FLAG_ENCODE_AMP</constant>
349
-
</entry>
350
-
<entry>
351
-
Strip tags and HTML-encode double and single quotes, optionally strip
352
-
or encode special characters. Encoding quotes can be
353
-
disabled by setting <constant>FILTER_FLAG_NO_ENCODE_QUOTES</constant>.
354
-
</entry>
355
-
</row>
356
-
<row>
357
-
<entry><constant>FILTER_SANITIZE_STRIPPED</constant></entry>
358
-
<entry>"stripped"</entry>
359
-
<entry></entry>
360
-
<entry>Alias of "string" filter.</entry>
361
-
</row>
362
-
<row>
363
-
<entry><constant>FILTER_SANITIZE_URL</constant></entry>
364
-
<entry>"url"</entry>
365
-
<entry></entry>
366
-
<entry>
367
-
Remove all characters except letters, digits and
368
-
<literal>$-_.+!*'(),{}|\\^~[]`&lt;&gt;#%";/?:@&amp;=</literal>.
369
-
</entry>
370
-
</row>
371
-
<row>
372
-
<entry><constant>FILTER_UNSAFE_RAW</constant></entry>
373
-
<entry>"unsafe_raw"</entry>
374
-
<entry>
375
-
<constant>FILTER_FLAG_STRIP_LOW</constant>,
376
-
<constant>FILTER_FLAG_STRIP_HIGH</constant>,
377
-
<constant>FILTER_FLAG_STRIP_BACKTICK</constant>,
378
-
<constant>FILTER_FLAG_ENCODE_LOW</constant>,
379
-
<constant>FILTER_FLAG_ENCODE_HIGH</constant>,
380
-
<constant>FILTER_FLAG_ENCODE_AMP</constant>
381
-
</entry>
382
-
<entry>
383
-
Do nothing, optionally strip or encode special characters. This
384
-
filter is also aliased to <constant>FILTER_DEFAULT</constant>.
385
-
</entry>
386
-
</row>
387
-
</tbody>
388
-
</tgroup>
389
-
</table>
390
-
</para>
391
-
<warning>
392
-
<para>
393
-
When using one of these filters as a default filter either through your ini file
394
-
or through your web server's configuration, the default flags is set to
395
-
<constant>FILTER_FLAG_NO_ENCODE_QUOTES</constant>. You need to explicitly set
396
-
filter.default_flags to 0 to have quotes encoded by default. Like this:
397
-
<example>
398
-
<title>Configuring the default filter to act like htmlspecialchars</title>
399
-
<programlisting role="php">
400
-
<![CDATA[
401
-
filter.default = full_special_chars
402
-
filter.default_flags = 0
403
-
]]>
404
-
</programlisting>
405
-
</example>
406
-
</para>
407
-
</warning>
408
-
409
-
<simplesect role="changelog">
410
-
&reftitle.changelog;
411
-
<para>
412
-
<informaltable>
413
-
<tgroup cols="2">
414
-
<thead>
415
-
<row>
416
-
<entry>&Version;</entry>
417
-
<entry>&Description;</entry>
418
-
</row>
419
-
</thead>
420
-
<tbody>
421
-
<row>
422
-
<entry>8.0.0</entry>
423
-
<entry>
424
-
<constant>FILTER_SANITIZE_MAGIC_QUOTES</constant> has been removed.
425
-
</entry>
426
-
</row>
427
-
<row>
428
-
<entry>7.3.0</entry>
429
-
<entry>
430
-
<constant>FILTER_SANITIZE_ADD_SLASHES</constant> was added as a
431
-
replacement for <constant>FILTER_SANITIZE_MAGIC_QUOTES</constant>
432
-
</entry>
433
-
</row>
434
-
<row>
435
-
<entry>7.3.0</entry>
436
-
<entry>
437
-
<constant>FILTER_SANITIZE_MAGIC_QUOTES</constant> has been deprecated.
438
-
</entry>
439
-
</row>
440
-
</tbody>
441
-
</tgroup>
442
-
</informaltable>
443
-
</para>
444
-
</simplesect>
445
-

446
-
</section>
447
-
<!--}}}-->
448
-

449
-
<!-- Other filters: {{{-->
450
-
<section xml:id="filter.filters.misc">
451
-
<title>Other filters</title>
452
-
<para>
453
-
<table>
454
-
<title>List of miscellaneous filters</title>
455
-
<tgroup cols="5">
456
-
<thead>
457
-
<row>
458
-
<entry>ID</entry>
459
-
<entry>Name</entry>
460
-
<entry>Options</entry>
461
-
<entry>Flags</entry>
462
-
<entry>Description</entry>
463
-
</row>
464
-
</thead>
465
-
<tbody>
466
-
<row>
467
-
<entry><constant>FILTER_CALLBACK</constant></entry>
468
-
<entry>"callback"</entry>
469
-
<entry><type>callable</type> function or method</entry>
470
-
<entry>All flags are ignored</entry>
471
-
<entry>Call user-defined function to filter data.</entry>
472
-
</row>
473
-
</tbody>
474
-
</tgroup>
475
-
</table>
476
-
</para>
477
-
</section>
478
-
<!--}}}-->
479
-

480
-
<!-- Filter flags: {{{-->
481
-
<section xml:id="filter.filters.flags">
482
-
<title>Filter flags</title>
483
-
484
-
<para>
485
-
<table>
486
-
<title>List of filter flags</title>
487
-
<tgroup cols="3">
488
-
<thead>
489
-
<row>
490
-
<entry>ID</entry>
491
-
<entry>Used with</entry>
492
-
<entry>Description</entry>
493
-
</row>
494
-
</thead>
495
-
<tbody>
496
-
<row>
497
-
<entry><constant>FILTER_FLAG_STRIP_LOW</constant></entry>
498
-
<entry>
499
-
<constant>FILTER_SANITIZE_ENCODED</constant>,
500
-
<constant>FILTER_SANITIZE_SPECIAL_CHARS</constant>,
501
-
<constant>FILTER_SANITIZE_STRING</constant>,
502
-
<constant>FILTER_UNSAFE_RAW</constant>
503
-
</entry>
504
-
<entry>
505
-
Strips characters that have a numerical value &lt;32.
506
-
</entry>
507
-
</row>
508
-
<row>
509
-
<entry><constant>FILTER_FLAG_STRIP_HIGH</constant></entry>
510
-
<entry>
511
-
<constant>FILTER_SANITIZE_ENCODED</constant>,
512
-
<constant>FILTER_SANITIZE_SPECIAL_CHARS</constant>,
513
-
<constant>FILTER_SANITIZE_STRING</constant>,
514
-
<constant>FILTER_UNSAFE_RAW</constant>
515
-
</entry>
516
-
<entry>
517
-
Strips characters that have a numerical value &gt;127.
518
-
</entry>
519
-
</row>
520
-
<row>
521
-
<entry><constant>FILTER_FLAG_STRIP_BACKTICK</constant></entry>
522
-
<entry>
523
-
<constant>FILTER_SANITIZE_ENCODED</constant>,
524
-
<constant>FILTER_SANITIZE_SPECIAL_CHARS</constant>,
525
-
<constant>FILTER_SANITIZE_STRING</constant>,
526
-
<constant>FILTER_UNSAFE_RAW</constant>
527
-
</entry>
528
-
<entry>
529
-
Strips backtick characters.
530
-
</entry>
531
-
</row>
532
-
<row>
533
-
<entry><constant>FILTER_FLAG_ALLOW_FRACTION</constant></entry>
534
-
<entry>
535
-
<constant>FILTER_SANITIZE_NUMBER_FLOAT</constant>
536
-
</entry>
537
-
<entry>
538
-
Allows a period (<literal>.</literal>) as a fractional separator in
539
-
numbers.
540
-
</entry>
541
-
</row>
542
-
<row>
543
-
<entry><constant>FILTER_FLAG_ALLOW_THOUSAND</constant></entry>
544
-
<entry>
545
-
<constant>FILTER_SANITIZE_NUMBER_FLOAT</constant>,
546
-
<constant>FILTER_VALIDATE_FLOAT</constant>
547
-
</entry>
548
-
<entry>
549
-
Allows a comma (<literal>,</literal>) as a thousands separator in
550
-
numbers.
551
-
</entry>
552
-
</row>
553
-
<row>
554
-
<entry><constant>FILTER_FLAG_ALLOW_SCIENTIFIC</constant></entry>
555
-
<entry>
556
-
<constant>FILTER_SANITIZE_NUMBER_FLOAT</constant>
557
-
</entry>
558
-
<entry>
559
-
Allows an <literal>e</literal> or <literal>E</literal> for scientific
560
-
notation in numbers.
561
-
</entry>
562
-
</row>
563
-
<row>
564
-
<entry><constant>FILTER_FLAG_NO_ENCODE_QUOTES</constant></entry>
565
-
<entry>
566
-
<constant>FILTER_SANITIZE_STRING</constant>
567
-
</entry>
568
-
<entry>
569
-
If this flag is present, single (<literal>'</literal>) and double
570
-
(<literal>"</literal>) quotes will not be encoded.
571
-
</entry>
572
-
</row>
573
-
<row>
574
-
<entry><constant>FILTER_FLAG_ENCODE_LOW</constant></entry>
575
-
<entry>
576
-
<constant>FILTER_SANITIZE_ENCODED</constant>,
577
-
<constant>FILTER_SANITIZE_STRING</constant>,
578
-
<constant>FILTER_SANITIZE_RAW</constant>
579
-
</entry>
580
-
<entry>
581
-
Encodes all characters with a numerical value &lt;32.
582
-
</entry>
583
-
</row>
584
-
<row>
585
-
<entry><constant>FILTER_FLAG_ENCODE_HIGH</constant></entry>
586
-
<entry>
587
-
<constant>FILTER_SANITIZE_ENCODED</constant>,
588
-
<constant>FILTER_SANITIZE_SPECIAL_CHARS</constant>,
589
-
<constant>FILTER_SANITIZE_STRING</constant>,
590
-
<constant>FILTER_SANITIZE_RAW</constant>
591
-
</entry>
592
-
<entry>
593
-
Encodes all characters with a numerical value &gt;127.
594
-
</entry>
595
-
</row>
596
-
<row>
597
-
<entry><constant>FILTER_FLAG_ENCODE_AMP</constant></entry>
598
-
<entry>
599
-
<constant>FILTER_SANITIZE_STRING</constant>,
600
-
<constant>FILTER_SANITIZE_RAW</constant>
601
-
</entry>
602
-
<entry>
603
-
Encodes ampersands (<literal>&amp;</literal>).
604
-
</entry>
605
-
</row>
606
-
<row>
607
-
<entry><constant>FILTER_NULL_ON_FAILURE</constant></entry>
608
-
<entry>
609
-
any <link linkend="filter.filters.validate"><constant>FILTER_VALIDATE_*</constant></link>
610
-
</entry>
611
-
<entry>
612
-
Returns &null; for unrecognized values.
613
-
</entry>
614
-
</row>
615
-
<row>
616
-
<entry><constant>FILTER_FLAG_ALLOW_OCTAL</constant></entry>
617
-
<entry>
618
-
<constant>FILTER_VALIDATE_INT</constant>
619
-
</entry>
620
-
<entry>
621
-
Regards inputs starting with a zero (<literal>0</literal>) as octal
622
-
numbers. This only allows the succeeding digits to be
623
-
<literal>0-7</literal>.
624
-
</entry>
625
-
</row>
626
-
<row>
627
-
<entry><constant>FILTER_FLAG_ALLOW_HEX</constant></entry>
628
-
<entry>
629
-
<constant>FILTER_VALIDATE_INT</constant>
630
-
</entry>
631
-
<entry>
632
-
Regards inputs starting with <literal>0x</literal> or
633
-
<literal>0X</literal> as hexadecimal numbers. This only allows
634
-
succeeding characters to be <literal>a-fA-F0-9</literal>.
635
-
</entry>
636
-
</row>
637
-
<row>
638
-
<entry><constant>FILTER_FLAG_EMAIL_UNICODE</constant></entry>
639
-
<entry>
640
-
<constant>FILTER_VALIDATE_EMAIL</constant>
641
-
</entry>
642
-
<entry>
643
-
Allows the local part of the email address to contain Unicode characters.
644
-
</entry>
645
-
</row>
646
-
<row>
647
-
<entry><constant>FILTER_FLAG_IPV4</constant></entry>
648
-
<entry>
649
-
<constant>FILTER_VALIDATE_IP</constant>
650
-
</entry>
651
-
<entry>
652
-
Allows the IP address to be in IPv4 format.
653
-
</entry>
654
-
</row>
655
-
<row>
656
-
<entry><constant>FILTER_FLAG_IPV6</constant></entry>
657
-
<entry>
658
-
<constant>FILTER_VALIDATE_IP</constant>
659
-
</entry>
660
-
<entry>
661
-
Allows the IP address to be in IPv6 format.
662
-
</entry>
663
-
</row>
664
-
<row>
665
-
<entry><constant>FILTER_FLAG_NO_PRIV_RANGE</constant></entry>
666
-
<entry>
667
-
<constant>FILTER_VALIDATE_IP</constant>
668
-
</entry>
669
-
<entry>
670
-
<para>
671
-
Fails validation for the following private IPv4 ranges:
672
-
<literal>10.0.0.0/8</literal>, <literal>172.16.0.0/12</literal> and
673
-
<literal>192.168.0.0/16</literal>.
674
-
</para>
675
-
<para>
676
-
Fails validation for the IPv6 addresses starting with
677
-
<literal>FD</literal> or <literal>FC</literal>.
678
-
</para>
679
-
</entry>
680
-
</row>
681
-
<row>
682
-
<entry><constant>FILTER_FLAG_NO_RES_RANGE</constant></entry>
683
-
<entry>
684
-
<constant>FILTER_VALIDATE_IP</constant>
685
-
</entry>
686
-
<entry>
687
-
<para>
688
-
Fails validation for the following reserved IPv4 ranges:
689
-
<literal>0.0.0.0/8</literal>, <literal>169.254.0.0/16</literal>,
690
-
<literal>127.0.0.0/8</literal> and <literal>240.0.0.0/4</literal>.
691
-
</para>
692
-
<para>
693
-
Fails validation for the following reserved IPv6 ranges:
694
-
<literal>::1/128</literal>, <literal>::/128</literal>,
695
-
<literal>::ffff:0:0/96</literal> and <literal>fe80::/10</literal>.
696
-
</para>
697
-
<para>
698
-
These are the ranges that are marked as Reserved-By-Protocol in
699
-
<link xlink:href="&url.rfc;6890">RFC 6890</link>.
700
-
</para>
701
-
</entry>
702
-
</row>
703
-
<row>
704
-
<entry><constant>FILTER_FLAG_SCHEME_REQUIRED</constant></entry>
705
-
<entry>
706
-
<constant>FILTER_VALIDATE_URL</constant>
707
-
</entry>
708
-
<entry>
709
-
Requires the <acronym>URL</acronym> to contain a scheme part.
710
-
</entry>
711
-
</row>
712
-
<row>
713
-
<entry><constant>FILTER_FLAG_HOST_REQUIRED</constant></entry>
714
-
<entry>
715
-
<constant>FILTER_VALIDATE_URL</constant>
716
-
</entry>
717
-
<entry>
718
-
Requires the <acronym>URL</acronym> to contain a host part.
719
-
</entry>
720
-
</row>
721
-
<row>
722
-
<entry><constant>FILTER_FLAG_PATH_REQUIRED</constant></entry>
723
-
<entry>
724
-
<constant>FILTER_VALIDATE_URL</constant>
725
-
</entry>
726
-
<entry>
727
-
Requires the <acronym>URL</acronym> to contain a path part.
728
-
</entry>
729
-
</row>
730
-
<row>
731
-
<entry><constant>FILTER_FLAG_QUERY_REQUIRED</constant></entry>
732
-
<entry>
733
-
<constant>FILTER_VALIDATE_URL</constant>
734
-
</entry>
735
-
<entry>
736
-
Requires the <acronym>URL</acronym> to contain a query string.
737
-
</entry>
738
-
</row>
739
-
<row>
740
-
<entry><constant>FILTER_REQUIRE_SCALAR</constant></entry>
741
-
<entry>
742
-
</entry>
743
-
<entry>
744
-
Requires the value to be scalar.
745
-
</entry>
746
-
</row>
747
-
<row>
748
-
<entry><constant>FILTER_REQUIRE_ARRAY</constant></entry>
749
-
<entry>
750
-
</entry>
751
-
<entry>
752
-
Requires the value to be an array.
753
-
</entry>
754
-
</row>
755
-
<row>
756
-
<entry><constant>FILTER_FORCE_ARRAY</constant></entry>
757
-
<entry>
758
-
</entry>
759
-
<entry>
760
-
If the value is a scalar, it is treated as array with the scalar value
761
-
as only element.
762
-
</entry>
763
-
</row>
764
-
</tbody>
765
-
</tgroup>
766
-
</table>
767
-
</para>
768
-

769
-
<simplesect role="changelog">
770
-
&reftitle.changelog;
771
-
<para>
772
-
<informaltable>
773
-
<tgroup cols="2">
774
-
<thead>
775
-
<row>
776
-
<entry>&Version;</entry>
777
-
<entry>&Description;</entry>
778
-
</row>
779
-
</thead>
780
-
<tbody>
781
-
<row>
782
-
<entry>7.3.0</entry>
783
-
<entry>
784
-
The explicit usage of <constant>FILTER_FLAG_SCHEME_REQUIRED</constant>
785
-
and <constant>FILTER_FLAG_HOST_REQUIRED</constant> has been deprecated.
786
-
</entry>
787
-
</row>
788
-
<row>
789
-
<entry>7.1.0</entry>
790
-
<entry>
791
-
<constant>FILTER_FLAG_EMAIL_UNICODE</constant> has been added.
792
-
</entry>
793
-
</row>
794
-
</tbody>
795
-
</tgroup>
796
-
</informaltable>
797
-
</para>
798
-
</simplesect>
799
-
</section>
800
-
<!--}}}-->
801
-
</chapter>
802
-

803
-
<!-- Keep this comment at the end of the file
804
-
Local variables:
805
-
mode: sgml
806
-
sgml-omittag:t
807
-
sgml-shorttag:t
808
-
sgml-minimize-attributes:nil
809
-
sgml-always-quote-attributes:t
810
-
sgml-indent-step:1
811
-
sgml-indent-data:t
812
-
indent-tabs-mode:nil
813
-
sgml-parent-document:nil
814
-
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
815
-
sgml-exposed-tags:nil
816
-
sgml-local-catalogs:nil
817
-
sgml-local-ecat-files:nil
818
-
End:
819
-
vim600: syn=xml fen fdm=marker fdl=2 si
820
-
vim: et tw=78 syn=sgml
821
-
vi: ts=1 sw=1
822
-
-->
823
0