#32331 [Opn]: Why static properties cannot be redeclared?

From: Date: Mon, 21 Mar 2005 11:38:48 +0000
Subject: #32331 [Opn]: Why static properties cannot be redeclared?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-75658@lists.php.net to get a copy of this message
ID: 32331 User updated by: rael at grad dot icmc dot usp dot br -Summary: Why static properties cannot be overwrite? Reported By: rael at grad dot icmc dot usp dot br Status: Open Bug Type: Feature/Change Request Operating System: Windows XP Professional SP2 PHP Version: 5.0.1 New Comment: I was said "override", but the correct is "redeclare" in case of static properties. Previous Comments: ------------------------------------------------------------------------ [2005-03-16 11:58:13] rael at grad dot icmc dot usp dot br Description: ------------ I'm a longer time java programmer, and I'm trying PHP5. But, for my surprise, I saw that static properties cannot be overwrite. Why? This make not sense! Reproduce code: --------------- class a { protected static $v = "aa"; public static function foo(){ echo self::$v; } } class b extends a{ protected static $v = "bb"; public static function foo(){ echo self::$v; } } Expected result: ---------------- No runtime error Actual result: -------------- Cannot redeclare property static protected a::$v in class b ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32331&edit=1

« previous php.bugs (#75658) next »