xref: /PHP-7.4/ext/spl/tests/bug73686.phpt (revision 68bdd6d0)
1--TEST--
2Bug #73686 (Adding settype()ed values to ArrayObject results in references)
3--FILE--
4<?php
5
6$ao = new ArrayObject;
7
8foreach ([1, 2, 3] as $i => $var)
9{
10	settype($var, 'string');
11	$ao[$i] = $var;
12}
13var_dump($ao);
14
15$ao = new ArrayObject;
16
17foreach ([1, 2, 3] as $i => $var)
18{
19	$ao[$i] = &$var;
20}
21var_dump($ao);
22?>
23--EXPECTF--
24object(ArrayObject)#%d (1) {
25  ["storage":"ArrayObject":private]=>
26  array(3) {
27    [0]=>
28    string(1) "1"
29    [1]=>
30    string(1) "2"
31    [2]=>
32    string(1) "3"
33  }
34}
35object(ArrayObject)#%d (1) {
36  ["storage":"ArrayObject":private]=>
37  array(3) {
38    [0]=>
39    &int(3)
40    [1]=>
41    &int(3)
42    [2]=>
43    &int(3)
44  }
45}
46