#34390 [Asn->Opn]: Redefinition of static methods in subclasses
| From: | sniper@php.net | Date: | Mon, 12 Sep 2005 11:38:56 +0000 |
| Subject: | #34390 [Asn->Opn]: Redefinition of static methods in subclasses | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969370104@lists.php.net to get a copy of this message | ||
ID: 34390
Updated by: sniper@php.net
Reported By: cbelin at free dot fr
-Status: Assigned
+Status: Open
-Bug Type: Class/Object related
+Bug Type: Documentation problem
Operating System: Windows XP SP2
PHP Version: 5.0.4
Assigned To: sniper
New Comment:
Reclassified as docu bug.
Previous Comments:
------------------------------------------------------------------------
[2005-09-12 11:37:54] dmitry@php.net
This is documentation bug.
------------------------------------------------------------------------
[2005-09-07 11:54:31] sniper@php.net
Dmitry, shouldn't this procude an error..?
------------------------------------------------------------------------
[2005-09-06 13:49:50] cbelin at free dot fr
Description:
------------
Manual says that static members and methods cannot be redefined in
subclasses.
It seems that it's not completely true (at least with PHP 5.0.4 under
Windows XP), as redefining static methods in subclasses is allowed, and
works fine (i.e. without triggering errors even if error level includes
E_STRICT).
Reproduce code:
---------------
class Base
{
public static function foo()
{
return 'Foo...';
}
}
class Extended extends Base
{
public static function foo()
{
return 'Bar !!!';
}
}
echo Extended::foo();
Expected result:
----------------
An error, or the output of Base::foo()
Actual result:
--------------
It works, and prints 'Bar !!!'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34390&edit=1