php-src/Zend/tests/foreach_shadowed_dyn_property.phpt
Nikita Popov 149e6aaa99 Fix accessibility checks for dynamic properties
A dynamic property may be shadowed by a private/protected property.
Make sure we check property accessibility for non-indirect
properties as well.

Closes #3626.
2018-10-22 16:46:33 +02:00

30 lines
427 B
PHP

--TEST--
Dynamic property shadowed by private property
--FILE--
<?php
class Test {
private $prop = "Test";
function run() {
foreach ($this as $k => $v) {
echo "$k => $v\n";
}
var_dump(get_object_vars($this));
}
}
class Test2 extends Test {
}
$test2 = new Test2;
$test2->prop = "Test2";
$test2->run();
?>
--EXPECT--
prop => Test
array(1) {
["prop"]=>
string(4) "Test"
}