forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path011.phpt
34 lines (33 loc) · 952 Bytes
/
011.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--TEST--
filter_input()
--INI--
precision=14
--EXTENSIONS--
filter
--GET--
a=<b>test</b>&b=http://example.com
--POST--
c=<p>string</p>&d=12345.7
--FILE--
<?php
ini_set('html_errors', false);
var_dump(filter_input(INPUT_GET, "b", FILTER_SANITIZE_URL));
var_dump(filter_input(INPUT_GET, "a", FILTER_SANITIZE_SPECIAL_CHARS, array(1,2,3,4,5)));
try {
filter_input(INPUT_GET, "b", FILTER_VALIDATE_FLOAT, new stdClass);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
var_dump(filter_input(INPUT_POST, "d", FILTER_VALIDATE_FLOAT));
var_dump(filter_input(INPUT_POST, "c", FILTER_SANITIZE_SPECIAL_CHARS));
var_dump(filter_input(INPUT_POST, "d", FILTER_VALIDATE_INT));
echo "Done\n";
?>
--EXPECT--
string(18) "http://example.com"
string(27) "<b>test</b>"
filter_input(): Argument #4 ($options) must be of type array|int, stdClass given
float(12345.7)
string(29) "<p>string</p>"
bool(false)
Done