xref: /PHP-7.2/ext/filter/tests/036.phpt (revision 17ccbeec)
1--TEST--
2input_get_args() and references
3--SKIPIF--
4<?php if (!extension_loaded("filter")) print "skip"; ?>
5--FILE--
6<?php
7
8$var = "1";
9
10$data = array();
11$data["test1"] = 1;
12$data["test2"] = &$var;
13
14$args = array();
15$args["test1"] = FILTER_VALIDATE_INT;
16$args["test2"] = FILTER_VALIDATE_INT;
17
18$ret = filter_var_array($data, $args);
19var_dump($ret);
20var_dump($data); //should be separated, i.e. not reference anymore. looks like we can't change this, or it'd change the original zval instead..
21var_dump($var); //should be still string(1) "1"
22
23echo "Done\n";
24?>
25--EXPECTF--
26array(2) {
27  ["test1"]=>
28  int(1)
29  ["test2"]=>
30  int(1)
31}
32array(2) {
33  ["test1"]=>
34  int(1)
35  ["test2"]=>
36  &string(1) "1"
37}
38string(1) "1"
39Done
40