Skip to content

Commit d9fbbbc

Browse files
committed
Add additional protected visibility prototype test
See #3993 for context.
1 parent 7f72d77 commit d9fbbbc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Zend/tests/grandparent_prototype.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Protected visibility test case with a grandparent prototype
3+
--FILE--
4+
<?php
5+
6+
class A {
7+
protected function test() {}
8+
}
9+
class B extends A {
10+
public function test2($x) {
11+
$x->test(); // Uncaught Error: Call to protected method D::test() from context 'B'
12+
}
13+
}
14+
class C extends A {
15+
protected function test() {}
16+
}
17+
class D extends C {
18+
protected function test() {
19+
echo "Hello World!\n";
20+
}
21+
}
22+
(new B)->test2(new D);
23+
24+
?>
25+
--EXPECT--
26+
Hello World!

0 commit comments

Comments
 (0)