Add additional protected visibility prototype test

See https://github.com/php/php-src/pull/3993 for context.
This commit is contained in:
Nikita Popov 2019-03-28 10:14:14 +01:00
parent 7f72d771e8
commit d9fbbbc868

View file

@ -0,0 +1,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 context '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!