#34634 [Ver->Csd]: "const FOO = 1<<0" bits not allowed
| From: | vrana@php.net | Date: | Thu, 13 Oct 2005 13:25:29 +0000 |
| Subject: | #34634 [Ver->Csd]: "const FOO = 1<<0" bits not allowed | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969370585@lists.php.net to get a copy of this message | ||
ID: 34634
Updated by: vrana@php.net
Reported By: djmaze at cpgnuke dot com
-Status: Verified
+Status: Closed
Bug Type: Documentation problem
Operating System: Linux
PHP Version: 5.0.5
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
It's the same as with default values of function parameters: "The value
must be a constant expression, not (for example) a variable, a class
member, result of a mathematical operation or a function call."
Previous Comments:
------------------------------------------------------------------------
[2005-09-25 16:30:21] derick@php.net
This is a documentation problem.
------------------------------------------------------------------------
[2005-09-25 15:18:43] djmaze at cpgnuke dot com
Description:
------------
The manual at following address doesn't explain what kind of constants
you may define.
http://www.php.net/manual/en/language.oop5.constants.php
I've tried to use bits but PHP 5 generates a parse errors on those as
well.
Either add in the documentation which are allowed or extend the use of
const.
Reproduce code:
---------------
<?php
class bar
{
const ASSOC = 1<<0; # CRASH
const SQL_ASSOC = MYSQL_ASSOC; # Works
}
?>
Expected result:
----------------
A constant bit
Actual result:
--------------
Parse error: syntax error, unexpected T_SL, expecting ',' or ';'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34634&edit=1