Bug #61658 [Opn]: Inherited static properties are not overwritten

From: Date: Sat, 07 Apr 2012 06:16:39 +0000
Subject: Bug #61658 [Opn]: Inherited static properties are not overwritten
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-169298@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61658&edit=1 ID: 61658 User updated by: thomash dot usa at gmail dot com Reported by: thomash dot usa at gmail dot com Summary: Inherited static properties are not overwritten Status: Open Type: Bug Package: Class/Object related Operating System: Arch Linux -PHP Version: 5.4.0 +PHP Version: 5.3.8 Block user comment: N Private report: N New Comment: PHP Version set to 5.3.8 Previous Comments: ------------------------------------------------------------------------ [2012-04-07 06:10:30] thomash dot usa at gmail dot com Description: ------------ I'm not sure if this is a bug or if this is intended, but I didn't find anything in the documentation: If a class inherits a static property, but overrides it with its own static property, the property of the parent is used. (If the properties are not marked as static, I get the expected result) Test script: --------------- class A{ protected static $hi="Hello"; public function __construct(){ $class=get_class(); echo $class::$hi; } } class B extends A{ protected static $hi="What's up"; } $a=new A(); $b=new B(); Expected result: ---------------- HelloWhat's up Actual result: -------------- HelloHello ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61658&edit=1

« previous php.bugs (#169298) next »