php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31543 get_class_vars does not return private & protected variables
Submitted: 2005-01-13 18:14 UTC Modified: 2005-01-14 02:25 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: du at bestwaytech dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.0.3 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: du at bestwaytech dot com
New email:
PHP Version: OS:

 

 [2005-01-13 18:14 UTC] du at bestwaytech dot com
Description:
------------
get_class_vars does not return private and protected variables

Using PHP 5.0.3 with IIS under Windows XP Pro SP2

Reproduce code:
---------------
class test {
  private $a = "private";
  protected $b = "protected";
  public $c = "public";
}
print_r(get_class_vars("test"));

Expected result:
----------------
Array
(
    [a] => private
    [b] => protected
    [c] => public
)


Actual result:
--------------
Array
(
    [c] => public
)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-13 18:29 UTC] du at bestwaytech dot com
Just confirmed that it works right using PHP 5.0.2 with same settings
 [2005-01-14 02:25 UTC] jed@php.net
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

http://php.net/get_class_vars

"This function will return an associative array of default *public* properties of the class."

If I recall, this didn't work in 5.0.2 either.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 20:01:31 2024 UTC