xref: /PHP-8.3/Zend/tests/bug34467.phpt (revision f8d79582)
1--TEST--
2Bug #34467 (foreach + __get + __set incosistency)
3--FILE--
4<?php
5class abc {
6    private $arr;
7
8    function __set ($key, $value) {
9    $this->arr[$key] = $value;
10  }
11
12    function __get ($key) {
13      return $this->arr[$key];
14    }
15}
16$abc = new abc();
17foreach (array (1,2,3) as $abc->k => $abc->v) {
18    var_dump($abc->k,$abc->v);
19}
20?>
21--EXPECT--
22int(0)
23int(1)
24int(1)
25int(2)
26int(2)
27int(3)
28