#43054 [Opn->Bgs]: get_object_vars scope
| From: | johannes@php.net | Date: | Sat, 20 Oct 2007 19:42:08 +0000 |
| Subject: | #43054 [Opn->Bgs]: get_object_vars scope | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-118768@lists.php.net to get a copy of this message | ||
ID: 43054
Updated by: johannes@php.net
Reported By: pdobrigkeit at gmx dot de
-Status: Open
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Windows XP
PHP Version: 5.2.4
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
.
Previous Comments:
------------------------------------------------------------------------
[2007-10-20 19:35:10] felipensp at gmail dot com
This isn't a bug.
See http://br2.php.net/manual/en/language.oop5.visibility.php
------------------------------------------------------------------------
[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