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: test(): Argument #1 ($ref1) must be passed by reference, value given in %s on line %d
29
30Warning: test(): Argument #2 ($ref2) must be passed by reference, value given in %s on line %d
31bool(true)
32int(0)
33int(0)
34
35Warning: test(): Argument #1 ($ref1) must be passed by reference, value given in %s on line %d
36
37Warning: test(): Argument #2 ($ref2) must be passed by reference, value given in %s on line %d
38bool(true)
39int(0)
40int(0)
41
42Warning: test(): Argument #1 ($ref1) must be passed by reference, value given in %s on line %d
43
44Warning: test(): Argument #2 ($ref2) must be passed by reference, value given in %s on line %d
45bool(true)
46int(0)
47int(0)
48
49Warning: test(): Argument #1 ($ref1) must be passed by reference, value given in %s on line %d
50
51Warning: test(): Argument #2 ($ref2) must be passed by reference, value given in %s on line %d
52bool(true)
53int(0)
54int(0)
55