php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46441 Bitwise or not available in class definition
Submitted: 2008-10-31 22:16 UTC Modified: 2014-11-02 01:41 UTC
Votes:4
Avg. Score:3.8 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:3 (100.0%)
From: cpriest at warpmail dot net Assigned: requinix (profile)
Status: Closed Package: *General Issues
PHP Version: 5.2.6 OS: Linux/Apache
Private report: No CVE-ID: None
 [2008-10-31 22:16 UTC] cpriest at warpmail dot net
Description:
------------
Bitwise | and & are not available in class definition areas.

Reproduce code:
---------------
<?php
class a {
  const FLAG_1 = 1;
  const FLAG_2 = 2;

  protected $Flags = self::FLAG_1 | self::FLAG_2;
}

Expected result:
----------------
Properly compiled and having $Flags = 3 upon instantiation.

Actual result:
--------------
Compile error, expected ';' where '|' is.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-11-02 01:41 UTC] requinix@php.net
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: requinix
 [2014-11-02 01:41 UTC] requinix@php.net
Supported in 5.6.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Sep 23 20:00:01 2025 UTC