1--TEST--
2GH-16185: Incorrect indexing into dynamic property array
3--FILE--
4<?php
5
6class ByRef {
7    private $_virtualByRef = 'virtualByRef';
8}
9
10class ByVal extends ByRef {
11    public $_virtualByRef {
12        get => null;
13        set { $this->dynamicProp = $value; }
14    }
15}
16
17$object = new ByVal;
18foreach ($object as $value) {
19    var_dump($value);
20    $object->_virtualByRef = $value;
21}
22
23?>
24--EXPECTF--
25NULL
26
27Deprecated: Creation of dynamic property ByVal::$dynamicProp is deprecated in %s on line %d
28NULL
29