1--TEST-- 2foreach over hooked properties 3--FILE-- 4<?php 5 6class A extends stdClass { 7 public $foo { 8 &get => $this->foo; 9 } 10} 11 12$a = new A; 13foreach ($a as $k => &$v) { 14 if ($k == "foo") { 15 $a->bar = "baz"; 16 } 17 var_dump($k); 18} 19 20?> 21--EXPECT-- 22string(3) "foo" 23string(3) "bar" 24