php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #7992 Non-Quoted Strings = bad idea
Submitted: 2000-11-27 09:04 UTC Modified: 2000-11-27 15:54 UTC
From: walhu at xpoint dot at Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.2 OS: Linux/Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: walhu at xpoint dot at
New email:
PHP Version: OS:

 

 [2000-11-27 09:04 UTC] walhu at xpoint dot 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?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-27 15:54 UTC] torben@php.net
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  
-------------------------
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Fri Jun 12 05:00:01 2026 UTC