Bug #51340 [NEW]: const keyword inside code blocks causes parse error.

From: Date: Sun, 21 Mar 2010 03:15:39 +0000
Subject: Bug #51340 [NEW]: const keyword inside code blocks causes parse error.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-148795@lists.php.net to get a copy of this message
From: Operating system: Debian GNU/Linux x86_64 PHP version: 5.3.2 Package: Scripting Engine problem Bug Type: Bug Bug description:const keyword inside code blocks causes parse error. Description: ------------ I tried to define constant using new const keyword structure in PHP 5.3. This one worked fine: -- $ cat test1.php <?php const FOO = 1; echo FOO; -- I checkd also this one: $ cat test2.php -- <?php if(true) { define('FOO', 1); } echo FOO; -- But this one crushes: -- $ cat test3.php <?php if(true) { const FOO = 1; } echo FOO; -- In fact im not using PHP 5.3.2, but PHP 5.3.1, but i don't have any place to test it against PHP 5.3.2 and I don't see fix for this issue on changelog fixes list. Expected result: ---------------- 1 1 1 Actual result: -------------- 1 1 Parse error: syntax error, unexpected T_CONST in /home/wrzasq/public_html/engine/chillout/projects/application/test3.php on line 4 -- Edit bug report at http://bugs.php.net/bug.php?id=51340&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51340&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51340&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51340&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51340&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51340&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51340&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51340&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51340&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51340&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51340&r=support Expected behavior: http://bugs.php.net/fix.php?id=51340&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51340&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51340&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51340&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51340&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51340&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51340&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51340&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51340&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51340&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51340&r=mysqlcfg

« previous php.bugs (#148795) next »