ID:               43054
 Comment by:       felipensp at gmail dot com
 Reported By:      pdobrigkeit at gmx dot de
 Status:           Open
 Bug Type:         Unknown/Other Function
 Operating System: Windows XP
 PHP Version:      5.2.4
 New Comment:

This isn't a bug.
See http://br2.php.net/manual/en/language.oop5.visibility.php


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

[2007-10-20 19:08:44] pdobrigkeit at gmx dot de

Description:
------------
Inherited Objects call a get_object_vars method in a parent. Scope
should be of the type of object actually calling the method, but private
members of the child do not recognized.

Reproduce code:
---------------
<?php

class Base {
      function getObjectVars() {
            print_r(get_object_vars($this));
      }
}

class Child extends Base{
        private $varA   = 'VarA';
        protected $varB = 'VarB';
        public $varC    = 'VarC';
        
        function __construct() {        
            $this->getObjectVars();            
        }
}

$child = new Child();

?>

Expected result:
----------------
Array ([varA] => VarA [varB] => VarB [varC] => VarC )

Actual result:
--------------
Array ( [varB] => VarB [varC] => VarC )


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43054&edit=1

Reply via email to