xref: /PHP-8.0/Zend/tests/bug38772.phpt (revision 7aacc705)
1--TEST--
2Bug #38772 (inconsistent overriding of methods in different visibility contexts)
3--FILE--
4<?php
5class A {
6
7    public function __construct() {
8        $this -> foo();
9    }
10
11    private function foo() {
12        echo __METHOD__ . "\r\n";
13    }
14}
15
16class B extends A {
17    public function foo() {
18        echo __METHOD__ . "\r\n";
19    }
20}
21
22class C extends A {
23    protected function foo() {
24        echo __METHOD__ . "\r\n";
25    }
26}
27
28class D extends A {
29        private function foo() {
30                echo __METHOD__ . "\r\n";
31        }
32}
33
34$a = new A();
35$b = new B();
36$c = new C();
37$d = new D();
38?>
39--EXPECT--
40A::foo
41A::foo
42A::foo
43A::foo
44