php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #32331 Why static properties cannot be redeclared?
Submitted: 2005-03-16 11:58 UTC Modified: 2005-03-30 01:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: rael at grad dot icmc dot usp dot br Assigned:
Status: No Feedback Package: Feature/Change Request
PHP Version: 5.0.1 OS: Windows XP Professional SP2
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-03-16 11:58 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-21 12:38 UTC] 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-30 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 02:01:29 2024 UTC