xref: /PHP-5.6/Zend/tests/bug28442.phpt (revision 610c7fbe)
1--TEST--
2Bug #28442 (Changing a static variables in a class changes it across sub/super classes.)
3--FILE--
4<?php
5
6class ClassA
7{
8   static $prop;
9}
10
11class ClassB extends ClassA
12{
13   static $prop;
14}
15
16class ClassC extends ClassB
17{
18}
19
20echo "===INIT===\n";
21ClassA::$prop = 'A';
22ClassB::$prop = 'B';
23ClassC::$prop = 'C';
24var_dump(ClassA::$prop);
25var_dump(ClassB::$prop);
26var_dump(ClassC::$prop);
27
28echo "===SetA===\n";
29ClassA::$prop = 'A2';
30var_dump(ClassA::$prop);
31var_dump(ClassB::$prop);
32var_dump(ClassC::$prop);
33
34echo "===SetB===\n";
35ClassB::$prop = 'B2';
36var_dump(ClassA::$prop);
37var_dump(ClassB::$prop);
38var_dump(ClassC::$prop);
39
40echo "===SetC===\n";
41ClassC::$prop = 'C2';
42var_dump(ClassA::$prop);
43var_dump(ClassB::$prop);
44var_dump(ClassC::$prop);
45
46?>
47===DONE===
48--EXPECTF--
49===INIT===
50string(1) "A"
51string(1) "C"
52string(1) "C"
53===SetA===
54string(2) "A2"
55string(1) "C"
56string(1) "C"
57===SetB===
58string(2) "A2"
59string(2) "B2"
60string(2) "B2"
61===SetC===
62string(2) "A2"
63string(2) "C2"
64string(2) "C2"
65===DONE===
66