xref: /PHP-7.4/Zend/tests/bug71914.phpt (revision 256593ab)
1--TEST--
2Bug #71914 (Reference is lost in "switch")
3--FILE--
4<?php
5
6function bug(&$value) {
7	switch ($value) {
8	case "xxxx":
9		$value = true;
10		break;
11	}
12}
13
14function returnArray() {
15	$array = array();
16	$array["str"]  = "xxxx";
17	return $array;
18}
19
20class Foo {
21	public $array = array("str" => "xxxx");
22}
23
24function test($arr, &$dummy) {
25	bug($arr["str"]);
26	var_dump($arr["str"]);
27}
28
29$foo = new Foo();
30$arr = returnArray();
31
32$array = array("str" => "xxxx");
33test($array, $array["str"]);
34test($arr, $arr["str"]);
35test($foo->array, $foo->array["str"]);
36?>
37--EXPECT--
38bool(true)
39bool(true)
40bool(true)
41