PHP 4.0 Bug #7992 Updated: Non-Quoted Strings = bad idea
| From: | torben@php.net | Date: | Mon, 27 Nov 2000 20:54:13 +0000 |
| Subject: | PHP 4.0 Bug #7992 Updated: Non-Quoted Strings = bad idea | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-39319@lists.php.net to get a copy of this message | ||
ID: 7992
Updated by: torben
Reported By: walhu@xpoint.at
Status: Closed
Bug Type: Feature/Change Request
Assigned To:
Comments:
Already in the language. Use error_reporting(E_ALL) to
develop your apps and then turn down the reporting level for
production.
Script:
-------------------------
<?php
error_reporting(E_ALL);
$periodCount = 3;
$sum = 2 * periodCount; // missing $ at periodCount
echo "sum $sum";
?>
-------------------------
Ouput:
-------------------------
Warning: Use of undefined constant periodCount - assumed 'periodCount' in
/home/torben/public_html/phptest/__phplist.html on line 18
sum 0
-------------------------
Previous Comments:
---------------------------------------------------------------------------
[2000-11-27 09:04:47] walhu@xpoint.at
this codesnippet:
==========
$periodCount=3;
$sum = 2*periodCount; // missing $ at periodCount
echo "sum $sum";
==========
gives: "sum 0" as result
I expect to get a parse error because of the unknown identifier.
This kind of typo can be #very# hard to find.
Please remove/(make as option) these non-quoted strings.
Is there a feature (planned) to force the detection of non declared variables?
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7992