|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76871 get_class_vars() missing shadowed properties
Submitted: 2018-09-12 14:03 UTC Modified: -
From: Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
28 + 30 = ?
Subscribe to this entry?

 [2018-09-12 14:03 UTC]
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:

class A {
    private $foo = "a";

    public static function getClassVars() {
class B extends A {
    private $foo = "b"; // comment me out


Expected result:
array(1) {
  string(1) "a"

Actual result:
array(0) {


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Dec 02 16:01:27 2023 UTC