ID: 33208 User updated by: aneroid at gmail dot com Reported By: aneroid at gmail dot com Status: Open Bug Type: *Programming Data Structures Operating System: linux & windows PHP Version: 5.0.3 New Comment:
btw, it may imply corresponding bugs in 'constant()' and 'defined()'. imho, they would be better left untouched so it's easier to use them as they currently work. if they are fixed, they should produce E_WARNING/NOTICEs (worst case) so they can be suppressed with '@' when checking. this is especially true of constant(). (i'd entered this as a comment but it wasn't displaying) Previous Comments: ------------------------------------------------------------------------ [2005-06-01 02:26:17] aneroid at gmail dot com Description: ------------ define()ing a constant with spaces, / signs, etc. doesn't throw an error (or warning). i happened to try to create a constant with the name 'U/L DIR' and it worked. that's two illegal chars. since constant names like "2FOO" are checked and not allowed, shouldn't these also not be allowed? sure doesn't satisfy "The name of a constant follows the same rules as any label in PHP." or the regexp [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* a name like that obviously can't be used (tried quotes and braces) but it works just fine with 'defined()', 'constant()' and shows up in get_defined_constants(). Reproduce code: --------------- define('U/L DIR', 'myuploaddir'); if (defined('U/L DIR')) { //true echo 'yup'; echo constant('U/L DIR'); print_r(get_defined_constants()); } // all the lines above print 'myuploaddir' for 'U/L DIR' Expected result: ---------------- E_ERROR since it's violates label rules (an E_WARNING at the least?) Actual result: -------------- spaces, etc. work just fine. (it shouldn't) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33208&edit=1