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

From: Date: Wed, 07 Sep 2005 09:54:32 +0000
Subject: #34390 [Opn->Asn]: Redefinition of static methods in subclasses
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-84611@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: Open +Status: Assigned Bug Type: Class/Object related Operating System: Windows XP SP2 PHP Version: 5.0.4 -Assigned To: +Assigned To: dmitry New Comment: Dmitry, shouldn't this procude an error..? Previous Comments: ------------------------------------------------------------------------ [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.bugs (#84611) next »