#37052 [Opn->Bgs]: Parent class constants are not overriden by sub classes in static methods
| From: | helly@php.net | Date: | Wed, 12 Apr 2006 19:29:06 +0000 |
| Subject: | #37052 [Opn->Bgs]: Parent class constants are not overriden by sub classes in static methods | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-95710@lists.php.net to get a copy of this message | ||
ID: 37052
Updated by: helly@php.net
Reported By: rael at grad dot icmc dot usp dot br
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
-Operating System: Any
+Operating System: *
-PHP Version: 5.1.2
+PHP Version: 5.*
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This his nothing to do with overwriting consts. What you want is late
static binding and for that we already have a patch and decided to do
it if we are all happy with it (e.g. if the overall slowdown is not to
big).
Previous Comments:
------------------------------------------------------------------------
[2006-04-12 15:09:37] rael at grad dot icmc dot usp dot br
Changed to Feature/Change Request.
------------------------------------------------------------------------
[2006-04-12 11:54:06] mike@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Late static binding is in consideration.
------------------------------------------------------------------------
[2006-04-12 11:28:16] rael at grad dot icmc dot usp dot br
Description:
------------
Parent class constants are not overriden by sub classes in static
methods. Do this override is a common behave, like in Java language.
This is a very important feature to construct good class hierarchies.
Reproduce code:
---------------
<?php
class Father{
const NAME = "John";
public static function foo(){
echo self::NAME;
}
}
class Son extends Father{
const NAME = "John Junior";
}
Son::foo();
?>
Expected result:
----------------
Output of "John Junior"
Actual result:
--------------
Output of "John"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37052&edit=1