#34390 [NEW]: Redefinition of static methods in subclasses

From: Date: Tue, 06 Sep 2005 11:49:51 +0000
Subject: #34390 [NEW]: Redefinition of static methods in subclasses
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-84577@lists.php.net to get a copy of this message
From: cbelin at free dot fr Operating system: Windows XP SP2 PHP version: 5.0.4 PHP Bug Type: Class/Object related Bug description: Redefinition of static methods in subclasses 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 bug report at http://bugs.php.net/?id=34390&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34390&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34390&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34390&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34390&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34390&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34390&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34390&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34390&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34390&r=support Expected behavior: http://bugs.php.net/fix.php?id=34390&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34390&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34390&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34390&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34390&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34390&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34390&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34390&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34390&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34390&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34390&r=mysqlcfg

« previous php.bugs (#84577) next »