xref: /PHP-8.1/Zend/tests/bug70873.phpt (revision f8d79582)
1--TEST--
2Bug #70873 (Regression on private static properties access)
3--FILE--
4<?php
5
6class A {
7    private static $x = 1;
8}
9
10class B extends A {
11    function bar() {
12        var_dump(self::$x);
13    }
14};
15
16class C extends A {
17    function bar() {
18        var_dump(A::$x);
19    }
20};
21
22
23$a = new B;
24$a->bar();
25
26$b = new C;
27$b->bar();
28?>
29--EXPECTF--
30Fatal error: Uncaught Error: Cannot access private property B::$x in %sbug70873.php:%d
31Stack trace:
32#0 %sbug70873.php(%d): B->bar()
33#1 {main}
34  thrown in %sbug70873.php on line %d
35