1--TEST-- 2Foreach over object with shadowed private property 3--FILE-- 4<?php 5 6class Test { 7 private $prop = "Test"; 8 9 function run() { 10 foreach ($this as $k => $v) { 11 echo "$k => $v\n"; 12 } 13 var_dump(get_object_vars($this)); 14 } 15} 16class Test2 extends Test { 17 public $prop = "Test2"; 18} 19 20(new Test2)->run(); 21 22?> 23--EXPECT-- 24prop => Test 25array(1) { 26 ["prop"]=> 27 string(4) "Test" 28} 29