mirror of
https://github.com/php/php-src.git
synced 2025-08-16 22:18:50 +02:00
Add additional protected visibility prototype test
See https://github.com/php/php-src/pull/3993 for context.
This commit is contained in:
parent
7f72d771e8
commit
d9fbbbc868
1 changed files with 26 additions and 0 deletions
26
Zend/tests/grandparent_prototype.phpt
Normal file
26
Zend/tests/grandparent_prototype.phpt
Normal 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!
|
Loading…
Add table
Add a link
Reference in a new issue