bug28442.phpt 1005 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
--TEST--
Bug #28442 (Changing a static variables in a class changes it across sub/super classes.)
--FILE--
<?php

class ClassA
{
   static $prop;
}

class ClassB extends ClassA
{
   static $prop;
}

class ClassC extends ClassB
{
}

echo "===INIT===\n";
ClassA::$prop = 'A';
ClassB::$prop = 'B';
ClassC::$prop = 'C';
var_dump(ClassA::$prop);
var_dump(ClassB::$prop);
var_dump(ClassC::$prop);

echo "===SetA===\n";
ClassA::$prop = 'A2';
var_dump(ClassA::$prop);
var_dump(ClassB::$prop);
var_dump(ClassC::$prop);

echo "===SetB===\n";
ClassB::$prop = 'B2';
var_dump(ClassA::$prop);
var_dump(ClassB::$prop);
var_dump(ClassC::$prop);

echo "===SetC===\n";
ClassC::$prop = 'C2';
var_dump(ClassA::$prop);
var_dump(ClassB::$prop);
var_dump(ClassC::$prop);

?>
===DONE===
--EXPECTF--
===INIT===
string(1) "A"
string(1) "C"
string(1) "C"
===SetA===
string(2) "A2"
string(1) "C"
string(1) "C"
===SetB===
string(2) "A2"
string(2) "B2"
string(2) "B2"
===SetC===
string(2) "A2"
string(2) "C2"
string(2) "C2"
===DONE===