php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #34634 "const FOO = 1<<0" bits not allowed
Submitted: 2005-09-25 15:18 UTC Modified: 2005-10-13 15:25 UTC
From: djmaze at cpgnuke dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.0.5 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: djmaze at cpgnuke dot com
New email:
PHP Version: OS:

 

 [2005-09-25 15:18 UTC] 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 ';'

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-25 16:30 UTC] derick@php.net
This is a documentation problem.
 [2005-10-13 15:25 UTC] vrana@php.net
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."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC