Bug #16479 Updated: var declaration in class has no meaning?
| From: | mfischer@php.net | Date: | Mon, 08 Apr 2002 05:29:14 +0000 |
| Subject: | Bug #16479 Updated: var declaration in class has no meaning? | ||
| References: | 1 | Groups: | php.bugs php.doc |
| Request: | Send a blank email to php-bugs+get-4305@lists.php.net to get a copy of this message | ||
ID: 16479
Updated by: mfischer@php.net
Reported By: vdhome@idas.cz
Status: Open
-Bug Type: Class/Object related
+Bug Type: Documentation problem
Operating System: Win98SE
PHP Version: 4.0.6
New Comment:
Well, you have get_class_vars() which can retrieve all the default
properties (i.e. the ones declared with 'var $foo').
And your last suggestions is against the nature of PHP. You just do not
have to declare variables to use it.
Making this a doc problem though I'm not quite sure; letting the doc
team decide.
Previous Comments:
------------------------------------------------------------------------
[2002-04-07 18:31:55] vdhome@idas.cz
I am not sure whether this is a bug, a feature, or lack of a feature.
Perhaps this should be marked a "Feature Request" then... Anyway, here
goes: the var declaration in a class seems to have no meaning
whatsoever, except perhaps for documentation purposes. PHP allows me to
assign to class variables that weren't declared without even a warning
at the highest warning reporting level. That's actually not very
surprising since PHP doesn't otherwise have declarations of variables,
but what is then the meaning of var in classes?
I suggest that PHP should at least warn about class variables that
weren't declared.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=16479&edit=1