1--TEST--
2call_user_func() behavior with references
3--FILE--
4<?php
5
6function test(&$ref1, &$ref2) {
7    $ref1 += 42;
8    $ref2 -= 42;
9    return true;
10}
11
12$i = $j = 0;
13var_dump(call_user_func('test', $i, $j));
14var_dump($i, $j);
15
16var_dump(call_user_func_array('test', [$i, $j]));
17var_dump($i, $j);
18
19$x =& $i; $y =& $j;
20var_dump(call_user_func('test', $i, $j));
21var_dump($i, $j);
22
23var_dump(call_user_func_array('test', [$i, $j]));
24var_dump($i, $j);
25
26?>
27--EXPECTF--
28Warning: Parameter 1 to test() expected to be a reference, value given in %s on line %d
29
30Warning: Parameter 2 to test() expected to be a reference, value given in %s on line %d
31bool(true)
32int(0)
33int(0)
34
35Warning: Parameter 1 to test() expected to be a reference, value given in %s on line %d
36
37Warning: Parameter 2 to test() expected to be a reference, value given in %s on line %d
38bool(true)
39int(0)
40int(0)
41
42Warning: Parameter 1 to test() expected to be a reference, value given in %s on line %d
43
44Warning: Parameter 2 to test() expected to be a reference, value given in %s on line %d
45bool(true)
46int(0)
47int(0)
48
49Warning: Parameter 1 to test() expected to be a reference, value given in %s on line %d
50
51Warning: Parameter 2 to test() expected to be a reference, value given in %s on line %d
52bool(true)
53int(0)
54int(0)
55