Bug #76871 [NEW]: get_class_vars() missing shadowed properties

From: Date: Wed, 12 Sep 2018 14:03:20 +0000
Subject: Bug #76871 [NEW]: get_class_vars() missing shadowed properties
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217014@lists.php.net to get a copy of this message
From: nikic Operating system: PHP version: Irrelevant Package: Scripting Engine problem Bug Type: Bug Bug description:get_class_vars() missing shadowed properties Description: ------------ get_class_vars() fails to return in-scope private properties that have been shadowed in a child-class. This report is essentially the same as bug #46812, which has been incorrectly closed after an tangentially related documentation issue has been fixed. Test script: --------------- <?php class A { private $foo = "a"; public static function getClassVars() { var_dump(get_class_vars(B::class)); } } class B extends A { private $foo = "b"; // comment me out } A::getClassVars(); Expected result: ---------------- array(1) { ["foo"]=> string(1) "a" } Actual result: -------------- array(0) { } -- Edit bug report at https://bugs.php.net/bug.php?id=76871&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76871&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76871&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76871&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76871&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76871&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76871&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76871&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76871&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76871&r=support Expected behavior: https://bugs.php.net/fix.php?id=76871&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76871&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76871&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76871&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76871&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76871&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76871&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76871&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76871&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76871&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76871&r=mysqlcfg

« previous php.bugs (#217014) next »