xref: /PHP-7.2/ext/filter/tests/040.phpt (revision 17ccbeec)
1--TEST--
2filter_has_var() tests
3--SKIPIF--
4<?php if (!extension_loaded("filter")) die("skip"); ?>
5--GET--
6a=1&b=2&c=0
7--POST--
8ap[]=1&bp=test&cp=
9--FILE--
10<?php
11
12var_dump(filter_has_var());
13var_dump(filter_has_var(INPUT_GET,""));
14var_dump(filter_has_var(INPUT_GET,array()));
15var_dump(filter_has_var(INPUT_POST, "ap"));
16var_dump(filter_has_var(INPUT_POST, "cp"));
17var_dump(filter_has_var(INPUT_GET, "a"));
18var_dump(filter_has_var(INPUT_GET, "c"));
19var_dump(filter_has_var(INPUT_GET, "abc"));
20var_dump(filter_has_var(INPUT_GET, "cc"));
21var_dump(filter_has_var(-1, "cc"));
22var_dump(filter_has_var(0, "cc"));
23var_dump(filter_has_var("", "cc"));
24
25echo "Done\n";
26?>
27--EXPECTF--
28Warning: filter_has_var() expects exactly 2 parameters, 0 given in %s on line %d
29bool(false)
30bool(false)
31
32Warning: filter_has_var() expects parameter 2 to be string, array given in %s on line %d
33bool(false)
34bool(true)
35bool(true)
36bool(true)
37bool(true)
38bool(false)
39bool(false)
40bool(false)
41bool(false)
42
43Warning: filter_has_var() expects parameter 1 to be integer, string given in %s on line %d
44bool(false)
45Done
46