#29689 [Opn]: default value of protected member overrides default value of private

From: Date: Sun, 15 Aug 2004 20:03:51 +0000
Subject: #29689 [Opn]: default value of protected member overrides default value of private
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-64648@lists.php.net to get a copy of this message
ID: 29689 User updated by: php dot net at benjamin dot schulz dot name -Summary: protected member overrides private Reported By: php dot net at benjamin dot schulz dot name Status: Open Bug Type: Unknown/Other Function Operating System: linux PHP Version: 5.0.1 New Comment: default value of protected member overrides default value of private Previous Comments: ------------------------------------------------------------------------ [2004-08-15 21:52:17] php dot net at benjamin dot schulz dot name Description: ------------ protected member overrides private Reproduce code: --------------- <?php class foo { private $foo = 'foo'; function printFoo() { echo __CLASS__, ': ', $this->foo, '<br />'; } } class bar extends foo { protected $foo = 'bar'; function printFoo() { parent::printFoo(); echo __CLASS__, ': ', $this->foo, '<br />'; } } class baz extends bar { protected $foo = 'baz'; } $bar = new bar; $bar->printFoo(); echo '<hr />'; $baz = new baz(); $baz->printFoo(); ?> Expected result: ---------------- foo: foo bar: bar -- foo: foo bar: baz Actual result: -------------- foo: foo bar: bar -- foo: baz bar: baz ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29689&edit=1

« previous php.bugs (#64648) next »