ID:               25908
 User updated by:  kyle at putnamcabinets dot com
-Summary:          Class properties are added automatically (at compile
                   time?)
 Reported By:      kyle at putnamcabinets dot com
 Status:           Open
 Bug Type:         Class/Object related
 Operating System: Debian GNU/Linux (Sid)
 PHP Version:      5.0.0b1 (beta1)
 New Comment:

This also causes some undesired behavior (aside from being strange):

[EMAIL PROTECTED]:~$ 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
)


Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to