php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20295 get_class_vars doesn't show values
Submitted: 2002-11-07 02:51 UTC Modified: 2002-11-07 11:10 UTC
From: kkobashi at thegrid dot net Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.2.2 OS: Win NT 4.0
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: kkobashi at thegrid dot net
New email:
PHP Version: OS:

 

 [2002-11-07 02:51 UTC] kkobashi at thegrid dot net
class A
{
    var $hello;
    var $world;

    function A()
    {
        $this->hello = "hello";
    }
}

$a = get_class_vars("A");
foreach ($a as $key => $val)
{
    echo $key . ": " . $val . "<br>";
}

Output does not show the value as it suggests in the documentation. The output I get is:

hello: 
world: 

Notice that the value of $hello is not shown.
Docs say uninitialized variables are not shown. But clearly hello is initialized.

Calling this:
   $a = get_class_vars("A");
   print_r($a);

Produces:
   Array ( [hello] => [world] => ) 

Which also is wrong because of no values in hello

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-07 03:37 UTC] kkobashi at thegrid dot net
Sorry...

This is not a bug... only initialized class variables are shown.

Close this one
 [2002-11-07 11:10 UTC] msopacua@php.net
$this->bogus('onUserRequest');
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Oct 26 02:03:38 2021 UTC