#30642 [NEW]: static variables not inherited by other classes when extended

From: Date: Mon, 01 Nov 2004 03:53:02 +0000
Subject: #30642 [NEW]: static variables not inherited by other classes when extended
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-68555@lists.php.net to get a copy of this message
From: keith dot ward at gmail dot com Operating system: Debian Linux r3 unstable PHP version: 5CVS-2004-11-01 (dev) PHP Bug Type: Class/Object related Bug description: static variables not inherited by other classes when extended Description: ------------ When using extend to extend a class . Static variables are not inherited . Reproduce code: --------------- class a { public static $myvar; public function __construct() { $this->myvar = '1'; echo ' Set myvar to 1 ... ' . "\n"; var_dump($this); } } $a = new a(); class b extends a { function __construct() { echo 'DUmping from class b' . "\n"; var_dump($this); } } $a = new b(); ?> Expected result: ---------------- Set myvar to 1 ... object(a)#1 (1) { ["myvar"]=> string(1) "1" } Dumping from class b object(b)#2 (1) { ["myvar"]=> string(1) "1" } Actual result: -------------- Set myvar to 1 ... object(a)#1 (1) { ["myvar"]=> string(1) "1" } Dumping from class b object(b)#2 (0) { } -- Edit bug report at http://bugs.php.net/?id=30642&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30642&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30642&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30642&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30642&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30642&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30642&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30642&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30642&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30642&r=support Expected behavior: http://bugs.php.net/fix.php?id=30642&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30642&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30642&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30642&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30642&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30642&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30642&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30642&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30642&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30642&r=mysqlcfg

« previous php.bugs (#68555) next »