summaryrefslogtreecommitdiff
path: root/Zend/tests/grandparent_prototype.phpt
blob: 39d66f46f028f9174679274ec509828ab90be4f5 (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
--TEST--
Protected visibility test case with a grandparent prototype
--FILE--
<?php

class A {
    protected function test() {}
}
class B extends A {
    public function test2($x) {
        $x->test(); // Uncaught Error: Call to protected method D::test() from scope B
    }
}
class C extends A {
    protected function test() {}
}
class D extends C {
    protected function test() {
        echo "Hello World!\n";
    }
}
(new B)->test2(new D);

?>
--EXPECT--
Hello World!