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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2019 The PHP Group
All rights reserved.
Last updated: Mon Nov 11 23:01:33 2019 UTC