xref: /PHP-8.4/Zend/tests/029.phpt (revision e5348b91)
1--TEST--
2Testing assign to property of an object in an array
3--FILE--
4<?php
5
6$arr = array(new stdClass);
7
8$arr[0]->a = clone $arr[0];
9var_dump($arr);
10
11$arr[0]->b = new $arr[0];
12var_dump($arr);
13
14$arr[0]->c = $arr[0]->a;
15var_dump($arr);
16
17?>
18--EXPECT--
19array(1) {
20  [0]=>
21  object(stdClass)#1 (1) {
22    ["a"]=>
23    object(stdClass)#2 (0) {
24    }
25  }
26}
27array(1) {
28  [0]=>
29  object(stdClass)#1 (2) {
30    ["a"]=>
31    object(stdClass)#2 (0) {
32    }
33    ["b"]=>
34    object(stdClass)#3 (0) {
35    }
36  }
37}
38array(1) {
39  [0]=>
40  object(stdClass)#1 (3) {
41    ["a"]=>
42    object(stdClass)#2 (0) {
43    }
44    ["b"]=>
45    object(stdClass)#3 (0) {
46    }
47    ["c"]=>
48    object(stdClass)#2 (0) {
49    }
50  }
51}
52