reference/filter/filters.xml
372e1b4d392a909073c06aba5975d7bedbf0b725
...
...
@@ -42,6 +42,9 @@
42
42
returned only for "0", "false", "off", "no", and "", and
43
43
&null; is returned for all non-boolean values.
44
44
</para>
45
+
<para>
46
+
String values are trimmed using <function>trim</function> before comparison.
47
+
</para>
45
48
</entry>
46
49
</row>
47
50
<row>
...
...
@@ -103,7 +106,14 @@
103
106
<constant>FILTER_FLAG_ALLOW_THOUSAND</constant>,
104
107
<constant>FILTER_NULL_ON_FAILURE</constant>
105
108
</entry>
106
-
<entry>Validates value as float, optionally from the specified range, and converts to float on success.</entry>
109
+
<entry>
110
+
<para>
111
+
Validates value as float, optionally from the specified range, and converts to float on success.
112
+
</para>
113
+
<para>
114
+
String values are trimmed using <function>trim</function> before comparison.
115
+
</para>
116
+
</entry>
107
117
</row>
108
118
<row>
109
119
<entry><constant>FILTER_VALIDATE_INT</constant></entry>
...
...
@@ -118,7 +128,14 @@
118
128
<constant>FILTER_FLAG_ALLOW_HEX</constant>,
119
129
<constant>FILTER_NULL_ON_FAILURE</constant>
120
130
</entry>
121
-
<entry>Validates value as integer, optionally from the specified range, and converts to int on success.</entry>
131
+
<entry>
132
+
<para>
133
+
Validates value as integer, optionally from the specified range, and converts to int on success.
134
+
</para>
135
+
<para>
136
+
String values are trimmed using <function>trim</function> before comparison.
137
+
</para>
138
+
</entry>
122
139
</row>
123
140
<row>
124
141
<entry><constant>FILTER_VALIDATE_IP</constant></entry>
...
...
@@ -131,6 +148,7 @@
131
148
<constant>FILTER_FLAG_IPV6</constant>,
132
149
<constant>FILTER_FLAG_NO_PRIV_RANGE</constant>,
133
150
<constant>FILTER_FLAG_NO_RES_RANGE</constant>,
151
+
<constant>FILTER_FLAG_GLOBAL_RANGE</constant>,
134
152
<constant>FILTER_NULL_ON_FAILURE</constant>
135
153
</entry>
136
154
<entry>
...
...
@@ -205,6 +223,15 @@
205
223
<row>
206
224
<entry>8.0.0</entry>
207
225
<entry>
226
+
The <constant>FILTER_FLAG_SCHEME_REQUIRED</constant> and
227
+
<constant>FILTER_FLAG_HOST_REQUIRED</constant> flags for the
228
+
<constant>FILTER_VALIDATE_URL</constant> filter have been removed.
229
+
The <literal>scheme</literal> and <literal>host</literal> are (and have been) always required.
230
+
</entry>
231
+
</row>
232
+
<row>
233
+
<entry>8.0.0</entry>
234
+
<entry>
208
235
Added <constant>FILTER_VALIDATE_BOOL</constant> as an alias for <constant>FILTER_VALIDATE_BOOLEAN</constant>.
209
236
Using <constant>FILTER_VALIDATE_BOOL</constant> is preferred.
210
237
</entry>
...
...
@@ -325,7 +352,7 @@
325
352
<entry><constant>FILTER_SANITIZE_FULL_SPECIAL_CHARS</constant></entry>
326
353
<entry>"full_special_chars"</entry>
327
354
<entry>
328
-
<constant>FILTER_FLAG_NO_ENCODE_QUOTES</constant>,
355
+
<constant>FILTER_FLAG_NO_ENCODE_QUOTES</constant>
329
356
</entry>
330
357
<entry>
331
358
Equivalent to calling <function>htmlspecialchars</function> with <constant>ENT_QUOTES</constant> set. Encoding quotes can
...
...
@@ -351,13 +378,19 @@
351
378
Strip tags and HTML-encode double and single quotes, optionally strip
352
379
or encode special characters. Encoding quotes can be
353
380
disabled by setting <constant>FILTER_FLAG_NO_ENCODE_QUOTES</constant>.
381
+
(<emphasis>Deprecated</emphasis> as of PHP 8.1.0,
382
+
use <function>htmlspecialchars</function> instead.)
354
383
</entry>
355
384
</row>
356
385
<row>
357
386
<entry><constant>FILTER_SANITIZE_STRIPPED</constant></entry>
358
387
<entry>"stripped"</entry>
359
388
<entry></entry>
360
-
<entry>Alias of "string" filter.</entry>
389
+
<entry>
390
+
Alias of "string" filter.
391
+
(<emphasis>Deprecated</emphasis> as of PHP 8.1.0,
392
+
use <function>htmlspecialchars</function> instead.)
393
+
</entry>
361
394
</row>
362
395
<row>
363
396
<entry><constant>FILTER_SANITIZE_URL</constant></entry>
...
...
@@ -419,6 +452,13 @@ filter.default_flags = 0
419
452
</thead>
420
453
<tbody>
421
454
<row>
455
+
<entry>8.1.0</entry>
456
+
<entry>
457
+
<constant>FILTER_SANITIZE_STRING</constant> and
458
+
<constant>FILTER_SANITIZE_STRIPPED</constant> have been deprecated.
459
+
</entry>
460
+
</row>
461
+
<row>
422
462
<entry>8.0.0</entry>
423
463
<entry>
424
464
<constant>FILTER_SANITIZE_MAGIC_QUOTES</constant> has been removed.
...
...
@@ -575,7 +615,7 @@ filter.default_flags = 0
575
615
<entry>
576
616
<constant>FILTER_SANITIZE_ENCODED</constant>,
577
617
<constant>FILTER_SANITIZE_STRING</constant>,
578
-
<constant>FILTER_SANITIZE_RAW</constant>
618
+
<constant>FILTER_UNSAFE_RAW</constant>
579
619
</entry>
580
620
<entry>
581
621
Encodes all characters with a numerical value &lt;32.
...
...
@@ -587,7 +627,7 @@ filter.default_flags = 0
587
627
<constant>FILTER_SANITIZE_ENCODED</constant>,
588
628
<constant>FILTER_SANITIZE_SPECIAL_CHARS</constant>,
589
629
<constant>FILTER_SANITIZE_STRING</constant>,
590
-
<constant>FILTER_SANITIZE_RAW</constant>
630
+
<constant>FILTER_UNSAFE_RAW</constant>
591
631
</entry>
592
632
<entry>
593
633
Encodes all characters with a numerical value &gt;127.
...
...
@@ -597,7 +637,7 @@ filter.default_flags = 0
597
637
<entry><constant>FILTER_FLAG_ENCODE_AMP</constant></entry>
598
638
<entry>
599
639
<constant>FILTER_SANITIZE_STRING</constant>,
600
-
<constant>FILTER_SANITIZE_RAW</constant>
640
+
<constant>FILTER_UNSAFE_RAW</constant>
601
641
</entry>
602
642
<entry>
603
643
Encodes ampersands (<literal>&amp;</literal>).
...
...
@@ -701,6 +741,19 @@ filter.default_flags = 0
701
741
</entry>
702
742
</row>
703
743
<row>
744
+
<entry><constant>FILTER_FLAG_GLOBAL_RANGE</constant></entry>
745
+
<entry>
746
+
<constant>FILTER_VALIDATE_IP</constant>
747
+
</entry>
748
+
<entry>
749
+
<para>
750
+
Fails validation for non global IPv4/IPv6 ranges as found in
751
+
<link xlink:href="&url.rfc;6890">RFC 6890</link> with the
752
+
<literal>Global</literal> attribute being <literal>False</literal>.
753
+
</para>
754
+
</entry>
755
+
</row>
756
+
<row>
704
757
<entry><constant>FILTER_FLAG_SCHEME_REQUIRED</constant></entry>
705
758
<entry>
706
759
<constant>FILTER_VALIDATE_URL</constant>
...
...
@@ -749,7 +802,8 @@ filter.default_flags = 0
749
802
<entry>
750
803
</entry>
751
804
<entry>
752
-
Requires the value to be an array.
805
+
Requires the value to be an array. Filter given will be applied to each
806
+
scalar entry of the array.
753
807
</entry>
754
808
</row>
755
809
<row>
...
...
@@ -779,6 +833,13 @@ filter.default_flags = 0
779
833
</thead>
780
834
<tbody>
781
835
<row>
836
+
<entry>8.2.0</entry>
837
+
<entry>
838
+
<constant>FILTER_FLAG_GLOBAL_RANGE</constant> as a flag to
839
+
<constant>FILTER_VALIDATE_IP</constant> has been added.
840
+
</entry>
841
+
</row>
842
+
<row>
782
843
<entry>7.3.0</entry>
783
844
<entry>
784
845
The explicit usage of <constant>FILTER_FLAG_SCHEME_REQUIRED</constant>
785
846