ID:               42355
 Updated by:       [EMAIL PROTECTED]
 Reported By:      adam dot huttler at fracturedatlas dot org
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Linux
 PHP Version:      5.2.3
 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

You can only initialize class constants with constant values. You pass
a statement which has to be evaluated at runtime, while the class
constants are defined at compile time which comes earlier.


Previous Comments:
------------------------------------------------------------------------

[2007-08-20 22:18:06] adam dot huttler at fracturedatlas dot org

Description:
------------
When defining a global constant, you can concatenate a string to
another constant. Doing this with class constants causes a parse error.

If this isn't considered a bug, please consider it a feature request,
as it would be very useful for configuration (especially file paths).

Thanks.

Reproduce code:
---------------
define('FOO', 'foo'); 

class Foobar 
{ 
    const MESSAGE = FOO . 'bar'; 
}

echo Foobar::MESSAGE;

Expected result:
----------------
foobar

Actual result:
--------------
Parse error: syntax error, unexpected '.', expecting ',' or ';'


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


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

Reply via email to