From:             joe at bigeasy dot com
Operating system: linux 2.6.11
PHP version:      5.0.4
PHP Bug Type:     Feature/Change Request
Bug description:  update 'const' to allow a calculated value, like define()

Description:
------------
similar to bug request 31554, http://bugs.php.net/bug.php?id=31554

can const be modified to be assigned output from an expression, similar to
the define() function?


Reproduce code:
---------------
define( 'TEST1', 3+3); //works
class devil {
    const TEST2 = 3+3; //parse error unexpected '+'
    const TEST3 = (3+3); //parse error unexpected '('
    public function __construct() {
        echo TEST1;
        echo self::TEST2;
        echo self::TEST3;
    }
}
$obFoo = new devil();

Expected result:
----------------
666

Actual result:
--------------
Parse error: parse error, unexpected '+', expecting ',' or ';'

-- 
Edit bug report at http://bugs.php.net/?id=33353&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33353&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33353&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33353&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33353&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33353&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33353&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33353&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33353&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33353&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33353&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33353&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33353&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33353&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33353&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33353&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33353&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33353&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33353&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33353&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33353&r=mysqlcfg

Reply via email to