xref: /PHP-8.2/ext/reflection/tests/bug49074.phpt (revision f8d79582)
1--TEST--
2Bug #49074 (private class static fields can be modified by using reflection)
3--FILE--
4<?php
5class Test {
6    private static $data1 = 1;
7    private static $data4 = 4;
8}
9
10class Test2 extends Test {
11    private static $data2 = 2;
12    public static $data3 = 3;
13}
14
15$r = new ReflectionClass('Test2');
16$m = $r->getStaticProperties();
17
18$m['data1'] = 100;
19$m['data2'] = 200;
20$m['data3'] = 300;
21$m['data4'] = 400;
22
23var_dump($r->getStaticProperties());
24?>
25--EXPECT--
26array(2) {
27  ["data2"]=>
28  int(2)
29  ["data3"]=>
30  int(3)
31}
32