xref: /PHP-7.3/ext/standard/tests/array/bug31213.phpt (revision 7101cd82)
1--TEST--
2Bug #31213 (Sideeffects caused by bug #29493)
3--FILE--
4<?php
5function test($use_extract) {
6	$a = 1;
7	$b = 1;
8
9	$arr = array(
10		'_a' => $a,
11		'_b' => &$b
12	);
13
14	var_dump($a, $b);
15
16	if ($use_extract) {
17		extract($arr, EXTR_REFS);
18	} else {
19		$_a = &$arr['_a'];
20		$_b = &$arr['_b'];
21	}
22
23	$_a++;
24	$_b++;
25
26	var_dump($a, $b, $_a, $_b, $arr);
27}
28
29test(false);
30test(true);
31
32?>
33--EXPECT--
34int(1)
35int(1)
36int(1)
37int(2)
38int(2)
39int(2)
40array(2) {
41  ["_a"]=>
42  &int(2)
43  ["_b"]=>
44  &int(2)
45}
46int(1)
47int(1)
48int(1)
49int(2)
50int(2)
51int(2)
52array(2) {
53  ["_a"]=>
54  &int(2)
55  ["_b"]=>
56  &int(2)
57}
58