1--TEST--
2call_user_func_array() passes by reference if the array element is referenced, regardless of function signature.
3--FILE--
4<?php
5
6function by_val($arg) {
7	$arg = 'changed';
8}
9
10function by_ref(&$arg) {
11	$arg = 'changed';
12}
13
14echo "------ Calling by_val() with unreferenced argument ------\n";
15$arg = array('original');
16call_user_func_array('by_val', $arg);
17var_dump($arg);
18
19echo "------ Calling by_ref() with unreferenced argument ------\n";
20$arg = array('original');
21call_user_func_array('by_ref', $arg);
22var_dump($arg);
23
24echo "------ Calling by_val() with referenced argument ------\n";
25$arg = array('original');
26$ref = &$arg[0];
27call_user_func_array('by_val', $arg);
28var_dump($arg);
29
30echo "------ Calling by_ref() with referenced argument ------\n";
31$arg = array('original');
32$ref = &$arg[0];
33call_user_func_array('by_ref', $arg);
34var_dump($arg);
35
36?>
37--EXPECTF--
38------ Calling by_val() with unreferenced argument ------
39array(1) {
40  [0]=>
41  string(8) "original"
42}
43------ Calling by_ref() with unreferenced argument ------
44
45Warning: Parameter 1 to by_ref() expected to be a reference, value given in %s on line %d
46array(1) {
47  [0]=>
48  string(8) "original"
49}
50------ Calling by_val() with referenced argument ------
51array(1) {
52  [0]=>
53  &string(7) "changed"
54}
55------ Calling by_ref() with referenced argument ------
56array(1) {
57  [0]=>
58  &string(7) "changed"
59}
60