Req #67935 [Opn->Nab]: define() constants with unallowed characters

From: Date: Sat, 30 Aug 2014 09:52:30 +0000
Subject: Req #67935 [Opn->Nab]: define() constants with unallowed characters
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187348@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67935&edit=1 ID: 67935 Updated by: nikic@php.net Reported by: 1nflktd at gmail dot com Summary: define() constants with unallowed characters -Status: Open +Status: Not a bug Type: Feature/Change Request Package: Scripting Engine problem Operating System: * PHP Version: Irrelevant Block user comment: N Private report: N New Comment: You can still access these constants through the constant() function, if you like. Previous Comments: ------------------------------------------------------------------------ [2014-08-30 01:48:28] 1nflktd at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=67935&edit=1

« previous php.bugs (#187348) next »