#30408 [NEW]: get_object_vars()

From: Date: Tue, 12 Oct 2004 09:03:28 +0000
Subject: #30408 [NEW]: get_object_vars()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-67468@lists.php.net to get a copy of this message
From: guth at fiifo dot u-psud dot fr Operating system: Linux PHP version: 5.0.2 PHP Bug Type: Class/Object related Bug description: get_object_vars() 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 bug report at http://bugs.php.net/?id=30408&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30408&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30408&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30408&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30408&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30408&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30408&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30408&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30408&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30408&r=support Expected behavior: http://bugs.php.net/fix.php?id=30408&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30408&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30408&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30408&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30408&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30408&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30408&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30408&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30408&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30408&r=mysqlcfg

« previous php.bugs (#67468) next »