Edit report at http://bugs.php.net/bug.php?id=52579&edit=1

 ID:                 52579
 Updated by:         [email protected]
 Reported by:        johnston dot joshua at gmail dot com
 Summary:            define() accepts characters out of range
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Any
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

A constant may contain any character. Use constant() to retrieve the
value. Only the parser doesn't allow any name but that's independent.


Previous Comments:
------------------------------------------------------------------------
[2010-08-10 21:51:44] johnston dot joshua at gmail dot com

Description:
------------
Constants can be defined with invalid characters in the name. The
documentation is correct but there seems to be no validation that
matches the docs when the constant's name is assigned to
zend_constant.name



According to the docs on Constants:



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]*

Test script:
---------------
<?php



define('/', 'slash');



echo constant('/'); // works



echo /; // parse error as expected



?>

Expected result:
----------------
define() should throw an error stating that the constant name has
invalid characters in it



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52579&edit=1

Reply via email to