From: Operating system: Any PHP version: 5.3.3 Package: Scripting Engine problem Bug Type: Bug Bug description:define() accepts characters out of range
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 bug report at http://bugs.php.net/bug.php?id=52579&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52579&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52579&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52579&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52579&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52579&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52579&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52579&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52579&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52579&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52579&r=support Expected behavior: http://bugs.php.net/fix.php?id=52579&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52579&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52579&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52579&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52579&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52579&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52579&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52579&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52579&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52579&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52579&r=mysqlcfg