php-src/Zend/tests/bug28442.phpt
Gabriel Caruso ded3d984c6 Use EXPECT instead of EXPECTF when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2018-02-20 21:53:48 +01:00

66 lines
1004 B
PHP

--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===
--EXPECT--
===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===