xref: /PHP-7.4/Zend/tests/objects_019.phpt (revision 5fa8f63a)
1--TEST--
2Testing references of dynamic properties
3--FILE--
4<?php
5
6error_reporting(E_ALL);
7
8$foo = array(new stdclass, new stdclass);
9
10$foo[1]->a = &$foo[0]->a;
11$foo[0]->a = 2;
12
13$x = $foo[1]->a;
14$x = 'foo';
15
16var_dump($foo, $x);
17
18?>
19--EXPECT--
20array(2) {
21  [0]=>
22  object(stdClass)#1 (1) {
23    ["a"]=>
24    &int(2)
25  }
26  [1]=>
27  object(stdClass)#2 (1) {
28    ["a"]=>
29    &int(2)
30  }
31}
32string(3) "foo"
33