xref: /PHP-8.0/Zend/tests/bug79862.phpt (revision e8430b59)
1--TEST--
2Bug #79862: Public non-static property in child should take priority over private static
3--FILE--
4<?php
5
6class a {
7    private static $prop1;
8    private static $prop2;
9    private $prop3;
10    private $prop4;
11    private static $prop5;
12    private static $prop6;
13    public function __construct() {
14        $this->prop1 = 1;
15        $this->prop2 = 2;
16        $this->prop3 = 3;
17        $this->prop4 = 4;
18        $this->prop5 = 5;
19        $this->prop6 = 6;
20        var_dump(self::$prop1);
21        var_dump(self::$prop2);
22        var_dump(self::$prop5);
23        var_dump(self::$prop6);
24        var_dump($this);
25    }
26}
27class c extends a {
28    public $prop1;
29    protected $prop2;
30    public static $prop3;
31    protected static $prop4;
32    public static $prop5;
33    protected static $prop6;
34}
35
36$c = new c;
37
38?>
39--EXPECTF--
40Notice: Accessing static property c::$prop5 as non static in %s on line %d
41
42Notice: Accessing static property c::$prop6 as non static in %s on line %d
43NULL
44NULL
45NULL
46NULL
47object(c)#1 (6) {
48  ["prop1"]=>
49  int(1)
50  ["prop2":protected]=>
51  int(2)
52  ["prop3":"a":private]=>
53  int(3)
54  ["prop4":"a":private]=>
55  int(4)
56  ["prop5"]=>
57  int(5)
58  ["prop6"]=>
59  int(6)
60}
61