From: guth at fiifo dot u-psud dot fr
Operating system: Linux (mandrake 10)
PHP version: 5.0.1
PHP Bug Type: Zend Engine 2 problem
Bug description: Problem with array in static properties
Description:
------------
[ sorry for english ]
There is a problem with static properties initialized as
an array in classes.
In the following code, if you replace "public static $test
= array();" by "public static $test;" or if you initialize
the property with not an array ("public static $test =
12;" for example), it works as expected.
Reproduce code:
---------------
<?
class A {
public static $test = array();
public function set($var) {
self::$test = $var;
}
public static function view() {
var_dump(self::$test);
}
}
class B extends A {
public static function view() {
var_dump(self::$test);
}
}
$class = new B;
$class->set(array('key' => 'value'));
A::view();
B::view();
?>
Expected result:
----------------
array(1) { ["key"]=> string(5) "value" }
array(1) { ["key"]=> string(5) "value" }
Actual result:
--------------
array(1) { ["key"]=> string(5) "value" }
array(0) { }
--
Edit bug report at http://bugs.php.net/?id=30140&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30140&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30140&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30140&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30140&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30140&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30140&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30140&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30140&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30140&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30140&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30140&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30140&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30140&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30140&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30140&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30140&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30140&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30140&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30140&r=mysqlcfg