diff --git a/reference/filter/book.xml b/reference/filter/book.xml index 8b0b12670a52..4865317e16b0 100644 --- a/reference/filter/book.xml +++ b/reference/filter/book.xml @@ -18,7 +18,7 @@ validation and sanitization. - Validation is used to + Validation is used to validate or check if the data meets certain qualifications. For example, passing in FILTER_VALIDATE_EMAIL will determine if the data is a valid email address, but will not change the data itself. diff --git a/reference/filter/constants.xml b/reference/filter/constants.xml index bc0139c4611c..91e1402a3a82 100644 --- a/reference/filter/constants.xml +++ b/reference/filter/constants.xml @@ -1,10 +1,17 @@ - + &reftitle.constants; &extension.constants; + + Input Constants + + These constants are used by + filter_input and + filter_input_array. + INPUT_POST @@ -84,6 +91,10 @@ + + + + Generic Filter Flags FILTER_FLAG_NONE @@ -102,7 +113,7 @@ - Flag used to require scalar as input + Flag used to require the input of the filter to be a scalar. @@ -113,7 +124,7 @@ - Require an array as input. + Flag used to require the input of the filter to be an array. @@ -124,7 +135,8 @@ - Always returns an array. + This flags wraps scalar inputs into a one element array + for filters which operate on arrays. @@ -135,552 +147,902 @@ - Use NULL instead of FALSE on failure. - - - - - - FILTER_VALIDATE_INT - (int) - - - - ID of "int" filter. - - - - - - FILTER_VALIDATE_BOOL - (int) - - - - Alias of FILTER_VALIDATE_BOOLEAN. - - - - - - FILTER_VALIDATE_BOOLEAN - (int) - - - - ID of "boolean" filter. - - - - - - FILTER_VALIDATE_FLOAT - (int) - - - - ID of "float" filter. - - - - - - FILTER_VALIDATE_REGEXP - (int) - - - - ID of "validate_regexp" filter. - - - - - - FILTER_VALIDATE_URL - (int) - - - - ID of "validate_url" filter. + Use &null; instead of &false; on failure. - - - - - FILTER_VALIDATE_DOMAIN - (int) - - - ID of "validate_domain" filter. - (Available as of PHP 7.0.0) + Usable with any validation + FILTER_VALIDATE_* + filter. - - - FILTER_VALIDATE_EMAIL - (int) - - - - ID of "validate_email" filter. - - - - - - FILTER_VALIDATE_IP - (int) - - - - ID of "validate_ip" filter. - - - - - - FILTER_VALIDATE_MAC - (int) - - - - ID of "validate_mac_address" filter. - - - - + + + + Sanitization Filter Flags + - FILTER_DEFAULT + FILTER_FLAG_STRIP_LOW (int) - ID of default ("unsafe_raw") filter. This is equivalent to - FILTER_UNSAFE_RAW. + Strip characters with ASCII value less than 32. - + - FILTER_UNSAFE_RAW + FILTER_FLAG_STRIP_HIGH (int) - ID of "unsafe_raw" filter. + Strip characters with ASCII value greater than 127. - + - FILTER_SANITIZE_STRING + FILTER_FLAG_STRIP_BACKTICK (int) - ID of "string" filter. - (Deprecated as of PHP 8.1.0, - use htmlspecialchars instead.) + Strips backtick (` characters. - + - FILTER_SANITIZE_STRIPPED + FILTER_FLAG_ENCODE_LOW (int) - ID of "stripped" filter. - (Deprecated as of PHP 8.1.0, - use htmlspecialchars instead.) + Encode characters with ASCII value less than 32. - + - FILTER_SANITIZE_ENCODED + FILTER_FLAG_ENCODE_HIGH (int) - ID of "encoded" filter. + Encode characters with ASCII value greater than 127. - + - FILTER_SANITIZE_SPECIAL_CHARS + FILTER_FLAG_ENCODE_AMP (int) - ID of "special_chars" filter. + Encode &. - + - FILTER_SANITIZE_FULL_SPECIAL_CHARS + FILTER_FLAG_NO_ENCODE_QUOTES (int) - ID of "full_special_chars" filter. + Singe and double quotes (' and ") + will not be encoded. - + - FILTER_SANITIZE_EMAIL + FILTER_FLAG_EMPTY_STRING_NULL (int) - ID of "email" filter. + + If sanitizing a string results in an empty string, + convert the value to &null; - + + + + Validation Filters + + - FILTER_SANITIZE_URL + FILTER_VALIDATE_BOOL (int) - ID of "url" filter. + Returns &true; for "1", + "true", + "on", + and "yes". - - - - - FILTER_SANITIZE_NUMBER_INT - (int) - - - ID of "number_int" filter. + Returns &false; for "0", + "false", + "off", + "no", and + "". - - - - - FILTER_SANITIZE_NUMBER_FLOAT - (int) - - - ID of "number_float" filter. + The return value for non-boolean values depends on the + FILTER_NULL_ON_FAILURE. + If it is set, &null; is returned, otherwise &false; is returned. - - - - - FILTER_SANITIZE_MAGIC_QUOTES - (int) - - + + Available options + + default + + + Value to return in case the filter fails. + + + + - ID of "magic_quotes" filter. - (DEPRECATED as of PHP 7.3.0 and - REMOVED as of PHP 8.0.0, - use FILTER_SANITIZE_ADD_SLASHES instead.) + Available as of PHP 8.0.0. - + + - FILTER_SANITIZE_ADD_SLASHES + FILTER_VALIDATE_BOOLEAN (int) - ID of "add_slashes" filter. - (Available as of PHP 7.3.0) + Alias of FILTER_VALIDATE_BOOL. + The alias was available prior to the introduction of its canonical + name in PHP 8.0.0. - + + - FILTER_CALLBACK + FILTER_VALIDATE_INT (int) - ID of "callback" filter. + Validates whether the value is an integer, + on success it is converted to type int. + + + + String values are trimmed using trim + before validation. + + + + + Available options + + default + + + Value to return in case the filter fails. + + + + + min_range + + + Value is only valid if it is greater than or equal to the provided value. + + + + + max_range + + + Value is only valid if it is less than or equal to the provided value. + + + + + + Optional Flags + + + FILTER_FLAG_ALLOW_OCTAL + (int) + + + + + Allow integers in octal notation + (0[0-7]+). + + + + + + FILTER_FLAG_ALLOW_HEX + (int) + + + + Allow integers in hexadecimal notation + (0x[0-9a-fA-F]+). + + + + - + + - FILTER_FLAG_ALLOW_OCTAL + FILTER_VALIDATE_FLOAT (int) - Allow octal notation (0[0-7]+) in "int" filter. + Validates whether the value is a float, + on success it is converted to type float. + + + + String values are trimmed using trim + before validation. + + + + + Available options + + default + + + Value to return in case the filter fails. + + + + + decimal + + + + + + + + min_range + + + Value is only valid if it is greater than or equal to the provided value. + Available as of PHP 7.4.0. + + + + + max_range + + + Value is only valid if it is less than or equal to the provided value. + Available as of PHP 7.4.0. + + + + + + Optional Flags + + + FILTER_FLAG_ALLOW_THOUSAND + (int) + + + + Accept commas (,), + which usually represent the thousand separator. + + + + - + - FILTER_FLAG_ALLOW_HEX + FILTER_VALIDATE_REGEXP (int) - Allow hex notation (0x[0-9a-fA-F]+) in "int" filter. + Validates value against the regular expression provided by the + regexp option. + + + Available options + + default + + + Value to return in case the filter fails. + + + + + regexp + + + Perl-compatible regular expression. + + + + - + + - FILTER_FLAG_STRIP_LOW + FILTER_VALIDATE_URL (int) - Strip characters with ASCII value less than 32. + Validates whether the URL name is valid according to + &url.rfc;2396. + + Available options + + default + + + Value to return in case the filter fails. + + + + + + Optional Flags + + + FILTER_FLAG_SCHEME_REQUIRED + (int) + + + + Requires the URL to contain a scheme part. + (Deprecated as of PHP 7.3.0 and removed as of PHP 8.0.0, as it is implied by the filter already.) + + + + + + FILTER_FLAG_HOST_REQUIRED + (int) + + + + Requires the URL to contain a host part. + (Deprecated as of PHP 7.3.0 and removed as of PHP 8.0.0, as it is implied by the filter already.) + + + + + + FILTER_FLAG_PATH_REQUIRED + (int) + + + + Requires the URL to contain a path part. + + + + + + FILTER_FLAG_QUERY_REQUIRED + (int) + + + + Requires the URL to contain a query part. + + + + + + + A valid URL may not specify the + HTTP protocol (http://). + Therefore, further validation may be required to determine if the + URL uses an expected protocol, + e.g. ssh:// or mailto:. + + + + + This filter only works on ASCII URLs. + This means that Internationalized Domain Names (IDN) will always be rejected. + + - + - FILTER_FLAG_STRIP_HIGH + FILTER_VALIDATE_DOMAIN (int) - Strip characters with ASCII value greater than 127. + Validates whether the domain name is valid according to + RFC 952, + RFC 1034, + RFC 1035, + RFC 1123, + RFC 2732, + and + RFC 2181. + + Available options + + default + + + Value to return in case the filter fails. + + + + + + Optional Flags + + + FILTER_FLAG_HOSTNAME + (int) + + + + Require hostnames to start with an alphanumeric character and contain + only alphanumerics or hyphens. + + + + - + - FILTER_FLAG_STRIP_BACKTICK + FILTER_VALIDATE_EMAIL (int) - Strips backtick characters. + Validates whether the value is a "valid" e-mail address. - - - - - FILTER_FLAG_ENCODE_LOW - (int) - - + - Encode characters with ASCII value less than 32. + The validation is performed against the addr-spec + syntax in + RFC 822. + However, comments, whitespace folding, and dotless domain names + are not supported, and thus will be rejected. + + + Available options + + default + + + Value to return in case the filter fails. + + + + + + Optional Flags + + + FILTER_FLAG_EMAIL_UNICODE + (int) + + + + Accepts Unicode characters in the local part. + Available as of PHP 7.1.0. + + + + + + + + Email validation is complex and the only true way to confirm an email + is valid and exists is to send an email to the address. + + - + + - FILTER_FLAG_ENCODE_HIGH + FILTER_VALIDATE_IP (int) - - Encode characters with ASCII value greater than 127. - + + Validates value as IP address. + + + Available options + + default + + + Value to return in case the filter fails. + + + + + + Optional Flags + + + FILTER_FLAG_IPV4 + (int) + + + + Allow IPv4 address. + + + + + + FILTER_FLAG_IPV6 + (int) + + + + Allow IPv6 address. + + + + + + FILTER_FLAG_NO_RES_RANGE + (int) + + + + Deny reserved addresses. + + + These are the ranges that are marked as + Reserved-By-Protocol in + RFC 6890. + + + Which for IPv4 corresponds to the following ranges: + + 0.0.0.0/8 + 169.254.0.0/16 + 127.0.0.0/8 + 240.0.0.0/4 + . + + + And for IPv6 corresponds to the following ranges: + + ::1/128 + ::/128 + ::FFFF:0:0/96 + FE80::/10 + . + + + + + + FILTER_FLAG_NO_PRIV_RANGE + (int) + + + + Deny private addresses. + + + These are IPv4 addresses which are in the following ranges: + + 10.0.0.0/8 + 172.16.0.0/12 + 192.168.0.0/16 + . + + + These are IPv6 addresses starting with + FD or FC. + + + + + + FILTER_FLAG_GLOBAL_RANGE + (int) + + + + Only allow global addresses. + These can be found in + RFC 6890 + where the Global attribute is True. + Available as of PHP 8.2.0. + + + + - + + - FILTER_FLAG_ENCODE_AMP + FILTER_VALIDATE_MAC (int) - Encode &. + Validates whether the value is a MAC address. + + + Available options + + default + + + Value to return in case the filter fails. + + + + - + + + + Sanitizing Filters + - FILTER_FLAG_NO_ENCODE_QUOTES + FILTER_UNSAFE_RAW (int) - Don't encode ' and ". + ID of "unsafe_raw" filter. - + - FILTER_FLAG_EMPTY_STRING_NULL + FILTER_DEFAULT (int) - (No use for now.) + Alias of FILTER_UNSAFE_RAW. - + - FILTER_FLAG_ALLOW_FRACTION + FILTER_SANITIZE_STRING (int) - Allow fractional part in "number_float" filter. + ID of "string" filter. + (Deprecated as of PHP 8.1.0, + use htmlspecialchars instead.) - + - FILTER_FLAG_ALLOW_THOUSAND + FILTER_SANITIZE_STRIPPED (int) - Allow thousand separator (,) in "number_float" filter. + Alias of FILTER_SANITIZE_STRING. + (Deprecated as of PHP 8.1.0, + use htmlspecialchars instead.) - + - FILTER_FLAG_ALLOW_SCIENTIFIC + FILTER_SANITIZE_ENCODED (int) - Allow scientific notation (e, E) in - "number_float" filter. + ID of "encoded" filter. - + - FILTER_FLAG_PATH_REQUIRED + FILTER_SANITIZE_SPECIAL_CHARS (int) - Require path in "validate_url" filter. + ID of "special_chars" filter. - + - FILTER_FLAG_QUERY_REQUIRED + FILTER_SANITIZE_FULL_SPECIAL_CHARS (int) - Require query in "validate_url" filter. - - - - - - FILTER_FLAG_SCHEME_REQUIRED - (int) - - - - Require scheme in "validate_url" filter. - (Deprecated as of PHP 7.3.0 and removed as of PHP 8.0.0, as it is implied in the filter already.) - - - - - - FILTER_FLAG_HOST_REQUIRED - (int) - - - - Require host in "validate_url" filter. - (Deprecated as of PHP 7.3.0 and removed as of PHP 8.0.0, as it is implied in the filter already.) + ID of "full_special_chars" filter. - + - FILTER_FLAG_HOSTNAME + FILTER_SANITIZE_EMAIL (int) - Require hostnames to start with an alphanumeric character and contain - only alphanumerics or hyphens. - (Available as of PHP 7.0.0) + Sanitize the string by remove all characters except + latin letters ([a-zA-Z]), + digits ([0-9]), + and the special characters + !#$%&'*+-=?^_`{|}~@.[]. - + - FILTER_FLAG_IPV4 + FILTER_SANITIZE_URL (int) - Allow only IPv4 address in "validate_ip" filter. + Sanitize the string by remove all characters except + latin letters ([a-zA-Z]), + digits ([0-9]), + and the special characters + $-_.+!*'(),{}|\\^~[]`<>#%";/?:@&=. - + - FILTER_FLAG_IPV6 + FILTER_SANITIZE_NUMBER_INT (int) - Allow only IPv6 address in "validate_ip" filter. + Sanitize the string by remove all characters except digits + ([0-9]), plus sign (+), + and minus sign (-). - + - FILTER_FLAG_NO_RES_RANGE + FILTER_SANITIZE_NUMBER_FLOAT (int) - Deny reserved addresses in "validate_ip" filter. + Sanitize the string by remove all characters except digits + ([0-9]), plus sign (+), + and minus sign (-). + + + Optional Flags + + + FILTER_FLAG_ALLOW_FRACTION + (int) + + + + Accept dot (.) character, + which usually represents the separator between the integer and + fractional parts. + + + + + + FILTER_FLAG_ALLOW_THOUSAND + (int) + + + + Accept commas (,) character, + which usually represents the thousand separator. + + + + + + FILTER_FLAG_ALLOW_SCIENTIFIC + (int) + + + + Accept numbers in scientific notation by allowing the + e and E characters. + + + + - + + - FILTER_FLAG_NO_PRIV_RANGE + FILTER_SANITIZE_ADD_SLASHES (int) - Deny private addresses in "validate_ip" filter. + Apply addslashes to the input. + Available as of PHP 7.3.0. - + + - FILTER_FLAG_GLOBAL_RANGE + FILTER_SANITIZE_MAGIC_QUOTES (int) - Only allow global addresses (per RFC 6890) in "validate_ip" filter. - (Available as of PHP 8.2.0) + Alias of FILTER_SANITIZE_ADD_SLASHES. + (DEPRECATED as of PHP 7.3.0 and + REMOVED as of PHP 8.0.0) - + + + + User Defined Filter + - FILTER_FLAG_EMAIL_UNICODE + FILTER_CALLBACK (int) + - Accepts Unicode characters in the local part in "validate_email" filter. - (Available as of PHP 7.1.0) + ID of "callback" filter. diff --git a/reference/filter/filters.xml b/reference/filter/filters.xml index ad9e6c0f2647..f0324ba4ef88 100644 --- a/reference/filter/filters.xml +++ b/reference/filter/filters.xml @@ -3,261 +3,6 @@ Types of filters - -
- Validate filters - - - Listing of filters for validation - - - - ID - Name - Options - Flags - Description - - - - - - FILTER_VALIDATE_BOOLEAN, - FILTER_VALIDATE_BOOL - - "boolean" - - default - - - FILTER_NULL_ON_FAILURE - - - - Returns &true; for "1", "true", "on" and "yes". - Returns &false; otherwise. - - - If FILTER_NULL_ON_FAILURE is set, &false; is - returned only for "0", "false", "off", "no", and "", and - &null; is returned for all non-boolean values. - - - String values are trimmed using trim before comparison. - - - - - FILTER_VALIDATE_DOMAIN - "validate_domain" - - default - - - FILTER_FLAG_HOSTNAME, - FILTER_NULL_ON_FAILURE - - - - Validates whether the domain name label lengths are valid. - - - Validates domain names against RFC 1034, RFC 1035, RFC 952, - RFC 1123, RFC 2732, RFC 2181, and RFC 1123. Optional flag - FILTER_FLAG_HOSTNAME adds ability to - specifically validate hostnames (they must start with an - alphanumeric character and contain only alphanumerics or - hyphens). - - - - - FILTER_VALIDATE_EMAIL - "validate_email" - - default - - - FILTER_FLAG_EMAIL_UNICODE, - FILTER_NULL_ON_FAILURE - - - - Validates whether the value is a valid e-mail address. - - - In general, this validates e-mail addresses against the addr-specsyntax in - RFC 822, with the exceptions that comments and whitespace folding - and dotless domain names - are not supported. - - - - - FILTER_VALIDATE_FLOAT - "float" - - default, - decimal, - min_range, - max_range - - - FILTER_FLAG_ALLOW_THOUSAND, - FILTER_NULL_ON_FAILURE - - - - Validates value as float, optionally from the specified range, and converts to float on success. - - - String values are trimmed using trim before comparison. - - - - - FILTER_VALIDATE_INT - "int" - - default, - min_range, - max_range - - - FILTER_FLAG_ALLOW_OCTAL, - FILTER_FLAG_ALLOW_HEX, - FILTER_NULL_ON_FAILURE - - - - Validates value as integer, optionally from the specified range, and converts to int on success. - - - String values are trimmed using trim before comparison. - - - - - FILTER_VALIDATE_IP - "validate_ip" - - default - - - FILTER_FLAG_IPV4, - FILTER_FLAG_IPV6, - FILTER_FLAG_NO_PRIV_RANGE, - FILTER_FLAG_NO_RES_RANGE, - FILTER_FLAG_GLOBAL_RANGE, - FILTER_NULL_ON_FAILURE - - - Validates value as IP address, optionally only IPv4 or IPv6 or not - from private or reserved ranges. - - - - FILTER_VALIDATE_MAC - "validate_mac_address" - - default - - - FILTER_NULL_ON_FAILURE - - Validates value as MAC address. - - - FILTER_VALIDATE_REGEXP - "validate_regexp" - - default, - regexp - - - FILTER_NULL_ON_FAILURE - - - Validates value against regexp, a - Perl-compatible regular expression. - - - - FILTER_VALIDATE_URL - "validate_url" - - default - - - FILTER_FLAG_SCHEME_REQUIRED, - FILTER_FLAG_HOST_REQUIRED, - FILTER_FLAG_PATH_REQUIRED, - FILTER_FLAG_QUERY_REQUIRED, - FILTER_NULL_ON_FAILURE - - Validates value as URL (according to &url.rfc;2396), optionally with required components. Beware a valid URL may not specify the HTTP protocol http:// so further validation may be required to determine the URL uses an expected protocol, e.g. ssh:// or mailto:. Note that the function will only find ASCII URLs to be valid; internationalized domain names (containing non-ASCII characters) will fail. - - - -
-
- - - When default is set to option, - default's value is used if value is not validated. - - - - - &reftitle.changelog; - - - - - - &Version; - &Description; - - - - - 8.0.0 - - The FILTER_FLAG_SCHEME_REQUIRED and - FILTER_FLAG_HOST_REQUIRED flags for the - FILTER_VALIDATE_URL filter have been removed. - The scheme and host are (and have been) always required. - - - - 8.0.0 - - Added FILTER_VALIDATE_BOOL as an alias for FILTER_VALIDATE_BOOLEAN. - Using FILTER_VALIDATE_BOOL is preferred. - - - - 7.4.0 - - Added min_range and max_range - options for FILTER_VALIDATE_FLOAT. - - - - 7.0.0 - - Added FILTER_FLAG_HOSTNAME and FILTER_VALIDATE_DOMAIN. - - - - - - - - -
- -
Sanitize filters @@ -274,15 +19,6 @@ - - FILTER_SANITIZE_EMAIL - "email" - - - Remove all characters except letters, digits and - !#$%&'*+-=?^_`{|}~@.[]. - - FILTER_SANITIZE_ENCODED "encoded" @@ -295,44 +31,6 @@ URL-encode string, optionally strip or encode special characters. - - FILTER_SANITIZE_MAGIC_QUOTES - "magic_quotes" - - - Apply addslashes. - (DEPRECATED as of PHP 7.3.0 and - REMOVED as of PHP 8.0.0, - use FILTER_SANITIZE_ADD_SLASHES instead.) - - - - FILTER_SANITIZE_ADD_SLASHES - "add_slashes" - - Apply addslashes. (Available as of PHP 7.3.0) - - - FILTER_SANITIZE_NUMBER_FLOAT - "number_float" - - FILTER_FLAG_ALLOW_FRACTION, - FILTER_FLAG_ALLOW_THOUSAND, - FILTER_FLAG_ALLOW_SCIENTIFIC - - - Remove all characters except digits, +- and - optionally .,eE. - - - - FILTER_SANITIZE_NUMBER_INT - "number_int" - - - Remove all characters except digits, plus and minus sign. - - FILTER_SANITIZE_SPECIAL_CHARS "special_chars" @@ -382,25 +80,6 @@ use htmlspecialchars instead.) - - FILTER_SANITIZE_STRIPPED - "stripped" - - - Alias of "string" filter. - (Deprecated as of PHP 8.1.0, - use htmlspecialchars instead.) - - - - FILTER_SANITIZE_URL - "url" - - - Remove all characters except letters, digits and - $-_.+!*'(),{}|\\^~[]`<>#%";/?:@&=. - - FILTER_UNSAFE_RAW "unsafe_raw" @@ -421,24 +100,7 @@ - - - When using one of these filters as a default filter either through your ini file - or through your web server's configuration, the default flags is set to - FILTER_FLAG_NO_ENCODE_QUOTES. You need to explicitly set - filter.default_flags to 0 to have quotes encoded by default. Like this: - - Configuring the default filter to act like htmlspecialchars - - - - - - - + &reftitle.changelog; @@ -458,25 +120,6 @@ filter.default_flags = 0 FILTER_SANITIZE_STRIPPED have been deprecated. - - 8.0.0 - - FILTER_SANITIZE_MAGIC_QUOTES has been removed. - - - - 7.3.0 - - FILTER_SANITIZE_ADD_SLASHES was added as a - replacement for FILTER_SANITIZE_MAGIC_QUOTES - - - - 7.3.0 - - FILTER_SANITIZE_MAGIC_QUOTES has been deprecated. - - @@ -569,37 +212,6 @@ filter.default_flags = 0 Strips backtick characters. - - FILTER_FLAG_ALLOW_FRACTION - - FILTER_SANITIZE_NUMBER_FLOAT - - - Allows a period (.) as a fractional separator in - numbers. - - - - FILTER_FLAG_ALLOW_THOUSAND - - FILTER_SANITIZE_NUMBER_FLOAT, - FILTER_VALIDATE_FLOAT - - - Allows a comma (,) as a thousands separator in - numbers. - - - - FILTER_FLAG_ALLOW_SCIENTIFIC - - FILTER_SANITIZE_NUMBER_FLOAT - - - Allows an e or E for scientific - notation in numbers. - - FILTER_FLAG_NO_ENCODE_QUOTES @@ -643,178 +255,6 @@ filter.default_flags = 0 Encodes ampersands (&). - - FILTER_NULL_ON_FAILURE - - any FILTER_VALIDATE_* - - - Returns &null; for unrecognized values. - - - - FILTER_FLAG_ALLOW_OCTAL - - FILTER_VALIDATE_INT - - - Regards inputs starting with a zero (0) as octal - numbers. This only allows the succeeding digits to be - 0-7. - - - - FILTER_FLAG_ALLOW_HEX - - FILTER_VALIDATE_INT - - - Regards inputs starting with 0x or - 0X as hexadecimal numbers. This only allows - succeeding characters to be a-fA-F0-9. - - - - FILTER_FLAG_EMAIL_UNICODE - - FILTER_VALIDATE_EMAIL - - - Allows the local part of the email address to contain Unicode characters. - - - - FILTER_FLAG_IPV4 - - FILTER_VALIDATE_IP - - - Allows the IP address to be in IPv4 format. - - - - FILTER_FLAG_IPV6 - - FILTER_VALIDATE_IP - - - Allows the IP address to be in IPv6 format. - - - - FILTER_FLAG_NO_PRIV_RANGE - - FILTER_VALIDATE_IP - - - - Fails validation for the following private IPv4 ranges: - 10.0.0.0/8, 172.16.0.0/12 and - 192.168.0.0/16. - - - Fails validation for the IPv6 addresses starting with - FD or FC. - - - - - FILTER_FLAG_NO_RES_RANGE - - FILTER_VALIDATE_IP - - - - Fails validation for the following reserved IPv4 ranges: - 0.0.0.0/8, 169.254.0.0/16, - 127.0.0.0/8 and 240.0.0.0/4. - - - Fails validation for the following reserved IPv6 ranges: - ::1/128, ::/128, - ::ffff:0:0/96 and fe80::/10. - - - These are the ranges that are marked as Reserved-By-Protocol in - RFC 6890. - - - - - FILTER_FLAG_GLOBAL_RANGE - - FILTER_VALIDATE_IP - - - - Fails validation for non global IPv4/IPv6 ranges as found in - RFC 6890 with the - Global attribute being False. - - - - - FILTER_FLAG_SCHEME_REQUIRED - - FILTER_VALIDATE_URL - - - Requires the URL to contain a scheme part. - - - - FILTER_FLAG_HOST_REQUIRED - - FILTER_VALIDATE_URL - - - Requires the URL to contain a host part. - - - - FILTER_FLAG_PATH_REQUIRED - - FILTER_VALIDATE_URL - - - Requires the URL to contain a path part. - - - - FILTER_FLAG_QUERY_REQUIRED - - FILTER_VALIDATE_URL - - - Requires the URL to contain a query string. - - - - FILTER_REQUIRE_SCALAR - - - - Requires the value to be scalar. - - - - FILTER_REQUIRE_ARRAY - - - - Requires the value to be an array. Filter given will be applied to each - scalar entry of the array. - - - - FILTER_FORCE_ARRAY - - - - If the value is a scalar, it is treated as array with the scalar value - as only element. - -