PHP 4.0 Bug #6587 Updated: get_class_vars returns empty array
| From: | Bug Database | Date: | Thu, 07 Sep 2000 14:11:41 +0000 |
| Subject: | PHP 4.0 Bug #6587 Updated: get_class_vars returns empty array | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-32552@lists.php.net to get a copy of this message | ||
ID: 6587
Updated by: stas
Reported By: jon@webglow.com
Status: Closed
Bug Type: Class/Object related
Assigned To:
Comments:
Please do var_dump to the result of get_class_vars and see how it is organized.
Previous Comments:
[2000-09-07 10:09:50] andrei@php.net
Run var_dump($vars). See the result.
---------------------------------------------------------------------------
[2000-09-07 10:07:57] jon@webglow.com
Hmmm... Perhaps I am just missing something here, but the following does not return anything either:
<?
class start_vars_list {
var $first_name='1';
var $last_name='2';
var $company='3';
}
$vars = get_class_vars(start_vars_list);
echo $vars[1];
?>
---------------------------------------------------------------------------
[2000-09-07 02:09:02] waldschrott@php.net
well, if you don´t initialize your variable with some value, get_class_vars() won´t return
anything
var $f='set';
will work,
anyway in the case of CLASSES it could make sense that variables that aren´t initialized and listed
instead with
var $f;
are returned too, *but* that would require significant changes, or another function like
get_unitialized_class_vars() or sth. else, because var_dump() cannot display something that is
between NULL and sth.
I think this only can be turned into a feature request (if possible at all, not sure) using another
function, or a parameter for the current function
comments anyone?
---------------------------------------------------------------------------
[2000-09-07 01:39:19] jon@webglow.com
I have tried:
<?
class start_vars_list {
var $first_name;
var $last_name;
var $company;
}
$vars = get_class_vars(start_vars_list);
echo $vars[1];
?>
$vars is an array, but contains no data. I was thinking that echo $vars[1];
should give me "last_name" but it does not return anything.
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=6587