xref: /PHP-8.3/ext/filter/tests/bug76366.phpt (revision 74859783)
1--TEST--
2Bug #76366 (references in sub-array for filtering breaks the filter)
3--EXTENSIONS--
4filter
5--FILE--
6<?php
7
8#array to filter
9$data = ['foo' => 6];
10
11#filter args
12$args = [
13    'foo'=> [
14        'filter' => FILTER_VALIDATE_INT,
15        'flags' => FILTER_FORCE_ARRAY
16    ]
17];
18
19$args['foo']['options'] = [];
20
21#create reference
22$options = &$args['foo']['options'];
23
24#set options
25$options['min_range'] = 1;
26$options['max_range'] = 5;
27
28#show the filter result
29var_dump(filter_var_array($data, $args));
30?>
31--EXPECT--
32array(1) {
33  ["foo"]=>
34  array(1) {
35    [0]=>
36    bool(false)
37  }
38}
39