xref: /PHP-8.3/ext/filter/tests/057.phpt (revision 74859783)
1--TEST--
2filter_input_array() and filter_var_array() with invalid $definition arguments
3--EXTENSIONS--
4filter
5--FILE--
6<?php
7foreach (array(null, true, false, 1, "", new stdClass) as $invalid) {
8    try {
9        var_dump(filter_input_array(INPUT_POST, $invalid));
10    } catch (TypeError $exception) {
11        echo $exception->getMessage() . "\n";
12    }
13
14    try {
15        var_dump(filter_var_array(array(), $invalid));
16    } catch (TypeError $exception) {
17        echo $exception->getMessage() . "\n";
18    }
19}
20?>
21--EXPECTF--
22Deprecated: filter_input_array(): Passing null to parameter #2 ($options) of type array|int is deprecated in %s on line %d
23
24Warning: filter_input_array(): Unknown filter with ID 0 in %s on line %d
25bool(false)
26
27Deprecated: filter_var_array(): Passing null to parameter #2 ($options) of type array|int is deprecated in %s on line %d
28
29Warning: filter_var_array(): Unknown filter with ID 0 in %s on line %d
30bool(false)
31
32Warning: filter_input_array(): Unknown filter with ID 1 in %s on line %d
33bool(false)
34
35Warning: filter_var_array(): Unknown filter with ID 1 in %s on line %d
36bool(false)
37
38Warning: filter_input_array(): Unknown filter with ID 0 in %s on line %d
39bool(false)
40
41Warning: filter_var_array(): Unknown filter with ID 0 in %s on line %d
42bool(false)
43
44Warning: filter_input_array(): Unknown filter with ID 1 in %s on line %d
45bool(false)
46
47Warning: filter_var_array(): Unknown filter with ID 1 in %s on line %d
48bool(false)
49filter_input_array(): Argument #2 ($options) must be of type array|int, string given
50filter_var_array(): Argument #2 ($options) must be of type array|int, string given
51filter_input_array(): Argument #2 ($options) must be of type array|int, stdClass given
52filter_var_array(): Argument #2 ($options) must be of type array|int, stdClass given
53