Req #67935 [NEW]: define() constants with unallowed characters
| From: | 1nflktd at gmail dot com | Date: | Sat, 30 Aug 2014 01:48:28 +0000 |
| Subject: | Req #67935 [NEW]: define() constants with unallowed characters | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-187345@lists.php.net to get a copy of this message | ||
From: 1nflktd at gmail dot com
Operating system: *
PHP version: Irrelevant
Package: Scripting Engine problem
Bug Type: Feature/Change Request
Bug description:define() constants with unallowed characters
Description:
------------
Defining constants with invalid characters (e.g. leading numbers) are
allowed, define() returns true, checking the constant with defined()
also returns true,
but when you try to use it you have a parse error.
Test script:
---------------
var_dump ( define ("0000X" , 1) );
var_dump ( defined ("0000X") );
echo 0000X;
http://sandbox.onlinephpfunctions.com/code/a7e955c09fbcc9e17a51ea56a75c70f8f60ab7e7
Expected result:
----------------
var_dump ( define ("0000X" , 1) ); // false, throwing an notice or a
warning
var_dump ( defined ("0000X") ); // false
echo 0000X; // Parse error
Actual result:
--------------
var_dump ( define ("0000X" , 1) ); // true
var_dump ( defined ("0000X") ); // true
echo 0000X; // Parse error
--
Edit bug report at https://bugs.php.net/bug.php?id=67935&edit=1
--