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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 03 14:01:29 2024 UTC