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