xref: /PHP-8.1/Zend/tests/bug76869.phpt (revision d30cd7d7)
1--TEST--
2Bug #76869 (Incorrect bypassing protected method accessibility check)
3--FILE--
4<?php
5class A {
6    private function f() {
7        return "A";
8    }
9}
10class B extends A {
11    protected function f() {
12        return "B";
13    }
14}
15$b = new B();
16try {
17    var_dump($b->f());
18} catch (Throwable $e) {
19    echo "Exception: ", $e->getMessage(), "\n";
20}
21?>
22--EXPECT--
23Exception: Call to protected method B::f() from global scope
24