#30408 [Opn->Fbk]: get_object_vars()
| From: | derick@php.net | Date: | Tue, 12 Oct 2004 09:16:32 +0000 |
| Subject: | #30408 [Opn->Fbk]: get_object_vars() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67469@lists.php.net to get a copy of this message | ||
ID: 30408
Updated by: derick@php.net
Reported By: guth at fiifo dot u-psud dot fr
-Status: Open
+Status: Feedback
Bug Type: Class/Object related
Operating System: Linux
PHP Version: 5.0.2
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2004-10-12 11:03:26] guth at fiifo dot u-psud dot fr
Description:
------------
I got another strange behaviour with classes functions.
get_class_methods(Object $obj) returns private and protected methods.
get_class_vars(string $class) returns private and protected
properties.
However, get_object_vars() doesn't.
This method takes an Object parameter and I think that its behaviour
should be the same as get_class_methods(Object $obj).
This bug is "related" to bug #30381.
Reproduce code:
---------------
<?php
class A {
protected $plip;
private function run() {
}
}
class B extends A {
}
class hariCow extends B {
private $plop = 'beta';
}
$db = new hariCow;
var_dump(get_class_vars('hariCow'));
var_dump(get_object_vars($db));
var_dump(get_class_methods($db));
echo $db->run();
?>
Expected result:
----------------
array(2) { ["plop"]=> string(4) "beta" ["plip"]=> NULL }
array(2) {
["plop"] => ... ["plip"] => ... }
array(1) { [0]=> string(3) "run" }
Actual result:
--------------
array(2) { ["plop"]=> string(4) "beta" ["plip"]=> NULL }
array(0) {
}
array(1) { [0]=> string(3) "run" }
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30408&edit=1