#14285 [Com]: Forcing variable declaration
| From: | z95kahe at mtek dot chalmers dot se | Date: | Tue, 19 Nov 2002 14:06:08 +0000 |
| Subject: | #14285 [Com]: Forcing variable declaration | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-25264@lists.php.net to get a copy of this message | ||
ID: 14285
Comment by: z95kahe@mtek.chalmers.se
Reported By: pnh102@psu.edu
Status: Open
Bug Type: Feature/Change Request
Operating System: Redhat Linux 7.2
PHP Version: 4.0.6
New Comment:
I realy think this is good idea. I've been looking for some tool to do
this kind of checks and found none.
For small scripts there is no need to have variable declaring but there
are for longer multi file, multi developer projects. By making the
checks an option we can have both modes available.
Previous Comments:
------------------------------------------------------------------------
[2001-11-29 11:39:07] hholzgra@php.net
this would only catch read usage of undefined variables,
but not assigning values to them
see:
<?php
$typofree = "hallo";
...
$xtypofree = "ooops";
?>
nothing in PHP will warn you that you have a typo
in the second assignment, so creating a new variable
unintended
... moved to feature requests ...
------------------------------------------------------------------------
[2001-11-29 11:20:18] derick@php.net
set error_reporting to E_ALL, and you'll see all undefined vars.
However, it doesn't force the use of it.
Derick
------------------------------------------------------------------------
[2001-11-29 11:17:16] pnh102@psu.edu
Is there a way to make PHP force you to declare variables like "option
explicit" in VBScript or "use strict" in Perl? If not, will this
feature become available? While this is not really a bug, it might be
a nice feature to have available.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=14285&edit=1