xref: /PHP-5.4/ext/filter/tests/007.phpt (revision 1d56aa09)
1--TEST--
2filter_has_var()
3--SKIPIF--
4<?php if (!extension_loaded("filter")) die("skip"); ?>
5--GET--
6a=qwe&abc=<a>href</a>
7--POST--
8b=qwe&bbc=<a>href</a>
9--FILE--
10<?php
11
12var_dump(filter_has_var(INPUT_GET, "a"));
13var_dump(filter_has_var(INPUT_GET, "abc"));
14var_dump(filter_has_var(INPUT_GET, "nonex"));
15var_dump(filter_has_var(INPUT_GET, " "));
16var_dump(filter_has_var(INPUT_GET, ""));
17var_dump(filter_has_var(INPUT_GET, array()));
18
19var_dump(filter_has_var(INPUT_POST, "b"));
20var_dump(filter_has_var(INPUT_POST, "bbc"));
21var_dump(filter_has_var(INPUT_POST, "nonex"));
22var_dump(filter_has_var(INPUT_POST, " "));
23var_dump(filter_has_var(INPUT_POST, ""));
24var_dump(filter_has_var(INPUT_POST, array()));
25
26var_dump(filter_has_var(-1, ""));
27var_dump(filter_has_var("", ""));
28var_dump(filter_has_var(array(), array()));
29var_dump(filter_has_var(array(), ""));
30var_dump(filter_has_var("", array()));
31
32echo "Done\n";
33?>
34--EXPECTF--
35bool(true)
36bool(true)
37bool(false)
38bool(false)
39bool(false)
40
41Warning: filter_has_var() expects parameter 2 to be string, array given in %s007.php on line %d
42bool(false)
43bool(true)
44bool(true)
45bool(false)
46bool(false)
47bool(false)
48
49Warning: filter_has_var() expects parameter 2 to be string, array given in %s007.php on line %d
50bool(false)
51bool(false)
52
53Warning: filter_has_var() expects parameter 1 to be long, string given in %s007.php on line %d
54bool(false)
55
56Warning: filter_has_var() expects parameter 1 to be long, array given in %s007.php on line %d
57bool(false)
58
59Warning: filter_has_var() expects parameter 1 to be long, array given in %s007.php on line %d
60bool(false)
61
62Warning: filter_has_var() expects parameter 1 to be long, string given in %s007.php on line %d
63bool(false)
64Done
65