#34390 [Opn->Csd]: Redefinition of static methods in subclasses

From: Date: Sat, 17 Sep 2005 14:53:15 +0000
Subject: #34390 [Opn->Csd]: Redefinition of static methods in subclasses
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969370160@lists.php.net to get a copy of this message
ID: 34390 Updated by: nforbes@php.net Reported By: cbelin at free dot fr -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Windows XP SP2 PHP Version: 5.0.4 New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2005-09-12 13:38:55] sniper@php.net Reclassified as docu bug. ------------------------------------------------------------------------ [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

« previous php.doc (#969370160) next »