forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
010.phpt
64 lines (61 loc) · 1.16 KB
/
010.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--TEST--
filter_var()
--INI--
precision=14
--SKIPIF--
<?php if (!extension_loaded("filter")) die("skip"); ?>
--FILE--
<?php
var_dump(filter_var(array(1,"1","", "-23234", "text", "asdf234asdfgs", array()), FILTER_VALIDATE_INT, FILTER_REQUIRE_ARRAY));
var_dump(filter_var(array(1.2,"1.7","", "-23234.123", "text", "asdf234.2asdfgs", array()), FILTER_VALIDATE_FLOAT, FILTER_REQUIRE_ARRAY));
var_dump(filter_var(1, array()));
var_dump(filter_var(1, FILTER_SANITIZE_STRING, 1));
var_dump(filter_var(1, FILTER_SANITIZE_STRING, 0));
var_dump(filter_var(1, FILTER_SANITIZE_STRING, array()));
var_dump(filter_var(1, -1, array(123)));
var_dump(filter_var(1, 0, array()));
echo "Done\n";
?>
--EXPECTF--
array(7) {
[0]=>
int(1)
[1]=>
int(1)
[2]=>
bool(false)
[3]=>
int(-23234)
[4]=>
bool(false)
[5]=>
bool(false)
[6]=>
array(0) {
}
}
array(7) {
[0]=>
float(1.2)
[1]=>
float(1.7)
[2]=>
bool(false)
[3]=>
float(-23234.123)
[4]=>
bool(false)
[5]=>
bool(false)
[6]=>
array(0) {
}
}
Warning: filter_var() expects parameter 2 to be long, array given in %s on line %d
NULL
string(1) "1"
string(1) "1"
string(1) "1"
bool(false)
bool(false)
Done