Edit report at https://bugs.php.net/bug.php?id=55447&edit=1
ID: 55447 Updated by: johan...@php.net Reported by: andre at neo-anime dot org Summary: Global constant declared as const parsed as class constant with token_get_all() -Status: Open +Status: Bogus Type: Bug Package: Scripting Engine problem Operating System: Linux PHP Version: 5.3SVN-2011-08-18 (SVN) Block user comment: N Private report: 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 The const keyword and the define() function work completely different. The const keyword is handled at compile time whereas define(), for the engine, is a regular function. Different tokens therefore are identifed as different code is generated internally, too. Previous Comments: ------------------------------------------------------------------------ [2011-08-18 13:54:45] andre at neo-anime dot org Test script should be <?php const BAR = FALSE; ------------------------------------------------------------------------ [2011-08-18 13:35:28] andre at neo-anime dot org Description: ------------ As of PHP 5.3.0 global constants can be declared using the const keyword in addition to the define() function. However token_get_all() incorrectly recognizes the former as a class constant. Test script: --------------- <?php define('BAR', FALSE); Expected result: ---------------- T_OPEN_TAG T_STRING T_CONSTANT_ENCAPSED_STRING T_WHITESPACE T_STRING Actual result: -------------- T_OPEN_TAG T_CONST T_WHITESPACE T_STRING T_WHITESPACE T_WHITESPACE T_STRING ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55447&edit=1