php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #60365 filter options
Submitted: 2011-11-23 13:36 UTC Modified: 2011-11-27 03:35 UTC
From: php at farawa dot de Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at farawa dot de
New email:
PHP Version: OS:

 

 [2011-11-23 13:36 UTC] php at farawa dot de
Description:
------------
i'm missing an example to get the native filter callback options...
would be great if you can enter them in the examples for the filter_ functions.
may they are some more that i missed within the test script?
valentin
---
From manual page: http://www.php.net/function.filter-var#refsect1-function.filter-var-examples
---


Test script:
---------------
<?php
print('<pre>');
$f = get_defined_constants('FILTER');
print_r( $f['filter'] );
print('</pre>');
?>
possible output:
Array
(
    [INPUT_POST] => 0
    [INPUT_GET] => 1
    [INPUT_COOKIE] => 2
    [INPUT_ENV] => 4
    [INPUT_SERVER] => 5
    [INPUT_SESSION] => 6
    [INPUT_REQUEST] => 99
    [FILTER_FLAG_NONE] => 0
    [FILTER_REQUIRE_SCALAR] => 33554432
    [FILTER_REQUIRE_ARRAY] => 16777216
    [FILTER_FORCE_ARRAY] => 67108864
    [FILTER_NULL_ON_FAILURE] => 134217728
    [FILTER_VALIDATE_INT] => 257
    [FILTER_VALIDATE_BOOLEAN] => 258
    [FILTER_VALIDATE_FLOAT] => 259
    [FILTER_VALIDATE_REGEXP] => 272
    [FILTER_VALIDATE_URL] => 273
    [FILTER_VALIDATE_EMAIL] => 274
    [FILTER_VALIDATE_IP] => 275
    [FILTER_DEFAULT] => 516
    [FILTER_UNSAFE_RAW] => 516
    [FILTER_SANITIZE_STRING] => 513
    [FILTER_SANITIZE_STRIPPED] => 513
    [FILTER_SANITIZE_ENCODED] => 514
    [FILTER_SANITIZE_SPECIAL_CHARS] => 515
    [FILTER_SANITIZE_EMAIL] => 517
    [FILTER_SANITIZE_URL] => 518
    [FILTER_SANITIZE_NUMBER_INT] => 519
    [FILTER_SANITIZE_NUMBER_FLOAT] => 520
    [FILTER_SANITIZE_MAGIC_QUOTES] => 521
    [FILTER_CALLBACK] => 1024
    [FILTER_FLAG_ALLOW_OCTAL] => 1
    [FILTER_FLAG_ALLOW_HEX] => 2
    [FILTER_FLAG_STRIP_LOW] => 4
    [FILTER_FLAG_STRIP_HIGH] => 8
    [FILTER_FLAG_ENCODE_LOW] => 16
    [FILTER_FLAG_ENCODE_HIGH] => 32
    [FILTER_FLAG_ENCODE_AMP] => 64
    [FILTER_FLAG_NO_ENCODE_QUOTES] => 128
    [FILTER_FLAG_EMPTY_STRING_NULL] => 256
    [FILTER_FLAG_ALLOW_FRACTION] => 4096
    [FILTER_FLAG_ALLOW_THOUSAND] => 8192
    [FILTER_FLAG_ALLOW_SCIENTIFIC] => 16384
    [FILTER_FLAG_SCHEME_REQUIRED] => 65536
    [FILTER_FLAG_HOST_REQUIRED] => 131072
    [FILTER_FLAG_PATH_REQUIRED] => 262144
    [FILTER_FLAG_QUERY_REQUIRED] => 524288
    [FILTER_FLAG_IPV4] => 1048576
    [FILTER_FLAG_IPV6] => 2097152
    [FILTER_FLAG_NO_RES_RANGE] => 4194304
    [FILTER_FLAG_NO_PRIV_RANGE] => 8388608
)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-23 13:45 UTC] php at farawa dot de
a coleuge gave me the tip to use the function filter_list() to get the possible call back options, but these are also others then used in your example, but in anyway the seams to be shorter and better for memoriziations...

<?php
print('<pre>');
print_r( filter_list() );
print('<pre>');
?>

example output:

Array
(
    [0] => int
    [1] => boolean
    [2] => float
    [3] => validate_regexp
    [4] => validate_url
    [5] => validate_email
    [6] => validate_ip
    [7] => string
    [8] => stripped
    [9] => encoded
    [10] => special_chars
    [11] => unsafe_raw
    [12] => email
    [13] => url
    [14] => number_int
    [15] => number_float
    [16] => magic_quotes
    [17] => callback
)
 [2011-11-27 03:35 UTC] frozenfire@php.net
-Status: Open +Status: Bogus
 [2011-11-27 03:35 UTC] frozenfire@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Aug 14 20:01:24 2020 UTC