#25908 [Opn->Bgs]: Inherited class properties aren't inherited until after class is parsed [?]

From: Date: Sun, 19 Oct 2003 08:58:41 +0000
Subject: #25908 [Opn->Bgs]: Inherited class properties aren't inherited until after class is parsed [?]
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-49191@lists.php.net to get a copy of this message
ID: 25908 Updated by: helly@php.net Reported By: kyle at putnamcabinets dot com -Status: Open +Status: Bogus Bug Type: Class/Object related -Operating System: Debian GNU/Linux (Sid) +Operating System: * -PHP Version: 5.0.0b1 (beta1) +PHP Version: 5* New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Duplicate of #25815, 25199 Previous Comments: ------------------------------------------------------------------------ [2003-10-19 04:03:37] kyle at putnamcabinets dot com This also causes some undesired behavior (aside from being strange): kputnam@linus:~$ php5 -n -r ' > class thing > { > protected $ribbit = 'ZOINKS'; > } > > class frog extends thing > { > function croak() > { > echo $this->ribbit; > } > } > > $f = new frog; > print_r($f);' frog Object ( [ribbit] => [ribbit:protected] => ZOINKS ) ------------------------------------------------------------------------ [2003-10-19 03:45:27] kyle at putnamcabinets dot com Description: ------------ Not sure if this is a bug, but certainly strange behavior. When class properties are mentioned in a function they are created even if the function is not called Reproduce code: --------------- php5 -n -r 'class frog { function croak() { echo $this->ribbit; } } $f = new frog; print_r($f);' Expected result: ---------------- frog Object ( ) Actual result: -------------- frog Object ( [ribbit] => ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25908&edit=1

« previous php.bugs (#49191) next »