#32331 [Opn->Fbk]: Why static properties cannot be redeclared?
| From: | tony2001@php.net | Date: | Mon, 21 Mar 2005 11:58:15 +0000 |
| Subject: | #32331 [Opn->Fbk]: Why static properties cannot be redeclared? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-75659@lists.php.net to get a copy of this message | ||
ID: 32331
Updated by: tony2001@php.net
Reported By: rael at grad dot icmc dot usp dot br
-Status: Open
+Status: Feedback
Bug Type: Feature/Change Request
Operating System: Windows XP Professional SP2
PHP Version: 5.0.1
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.0-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2005-03-21 12:38:45] rael at grad dot icmc dot usp dot br
I was said "override", but the correct is "redeclare" in case of static
properties.
------------------------------------------------------------------------
[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