This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 270924

Summary: Missing hint for invalid constant name
Product: php Reporter: nexxer
Component: EditorAssignee: issues@php <issues>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Windows 10 x64   
Issue Type: DEFECT Exception Reporter:

Description nexxer 2017-06-21 13:02:04 UTC
Netbeans allows defining a constant with a dot (".") in it without raising an error.

PHP constants must be made up of the following characters (from the documentation):

"The name of a constant follows the same rules as any label in PHP. A valid constant name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thusly: [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"


Steps to reproduce:
---------

error_reporting(E_ALL) ;
ini_set('display_errors', 1) ;
define('some.constant', 5) ;
echo some.constant ;


Expected behavior:
----------

Netbeans should alert me that "some.constant" is an invalid constant due to the dot.


Actual behavior:
----------

Netbeans allows this. Running the above code returns:

"Notice: Use of undefined constant some - assumed 'some' in test.php on line 7

Call Stack:
    0.0011     196328   1. {main}() test.php:0


Notice: Use of undefined constant constant - assumed 'constant' in test.php on line 7

Call Stack:
    0.0011     196328   1. {main}() test.php:0

someconstant"