xref: /PHP-5.6/tests/lang/bug21600.phpt (revision 79d6f11a)
1--TEST--
2Bug #21600 (assign by reference function call changes variable contents)
3--INI--
4error_reporting=4095
5--FILE--
6<?php
7$tmp = array();
8$tmp['foo'] = "test";
9$tmp['foo'] = &bar($tmp['foo']);
10var_dump($tmp);
11
12unset($tmp);
13
14$tmp = array();
15$tmp['foo'] = "test";
16$tmp['foo'] = &fubar($tmp['foo']);
17var_dump($tmp);
18
19function bar($text){
20  return $text;
21}
22
23function fubar($text){
24  $text = &$text;
25  return $text;
26}
27?>
28--EXPECTF--
29Strict Standards: Only variables should be assigned by reference in %sbug21600.php on line 4
30array(1) {
31  ["foo"]=>
32  string(4) "test"
33}
34
35Strict Standards: Only variables should be assigned by reference in %sbug21600.php on line 11
36array(1) {
37  ["foo"]=>
38  string(4) "test"
39}
40