summaryrefslogtreecommitdiff
path: root/Zend/tests/foreach_shadowed_property.phpt
blob: 55d5821e77f237ee13f982fb1a4da16d30819294 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--TEST--
Foreach over object with shadowed 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 {
    public $prop = "Test2";
}

(new Test2)->run();

?>
--EXPECT--
prop => Test
array(1) {
  ["prop"]=>
  string(4) "Test"
}