php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15682 Bitwise concatenation of constants in class variables
Submitted: 2002-02-22 17:14 UTC Modified: 2002-02-22 18:43 UTC
From: s-m-k at gmx dot net Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.1.1 OS: WinXP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: s-m-k at gmx dot net
New email:
PHP Version: OS:

 

 [2002-02-22 17:14 UTC] s-m-k at gmx dot net
class foo {

$var bar = E_ALL & ~E_NOTICE;

}

Obviously a scalar value (assigning a single value works perfectly), but the following appears when it comes to execution:

Parse error: parse error, expecting "," or ";"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-22 17:15 UTC] s-m-k at gmx dot net
class foo {

var $bar = E_ALL & ~E_NOTICE;

}

Obviously a scalar value (assigning a single value works perfectly), but
the following appears when it comes to execution:

Parse error: parse error, expecting "," or ";"
 [2002-02-22 18:43 UTC] derick@php.net
Not a bug. You can only use static assignments here:

From the manual @ http://www.php.net/manual/en/language.oop.php :

Note:  In PHP 4, only constant initializers for var  variables are allowed. To initialize variables with non-constant values, you need an initialization function which is called automatically when an object is being constructed from the class. Such a function is called a constructor (see below).

regards,
Derick
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Mar 11 07:01:30 2025 UTC