PHP 4.0 Bug #6587 Updated: get_class_vars returns empty array

From: Date: Thu, 07 Sep 2000 14:09:50 +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-32551@lists.php.net to get a copy of this message
ID: 6587 Updated by: andrei Reported By: jon@webglow.com Status: Open Bug Type: Class/Object related Assigned To: Comments: Run var_dump($vars). See the result. Previous Comments: [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

« previous php.dev (#32551) next »