php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9189 Cannot use bitwise operators in class initilization
Submitted: 2001-02-09 05:15 UTC Modified: 2001-02-09 05:39 UTC
From: yohgaki at dd dot iij4u dot or dot jp Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.4pl1 OS: RedHat Linux 7.0.1/j
Private report: No CVE-ID: None
 [2001-02-09 05:15 UTC] yohgaki at dd dot iij4u dot or dot jp
Initilizing class var as "var $varname = intval | intval;" causes error.
Both & and | gives the same error.

I'm using sevral non-standard extentions for Japanese language support. These extensions should be nothing to do with this problem. (These extentions do not patch to core distribution)

Please let me know if you need more info.

== PHP SOURCE ==
<?php 
define('C1',1);
define('C2',2);

class foo {
	var $b = C1 | C2;
	
	function foo() {
		echo "Called Constructor<br>\n";
		$this->b = C1 | C2;
	}

}

$c = new foo;
echo $c->b;

?>
==== PHP SOURCE END ======

==== ERROR MSG =====
Parse error: parse error, expecting `','' or `';'' in /home/httpd/httpd/html/tmp/test.html on line 6
==== ERROR MSG END =====

==== CONGIURE ====
./configure --with-apxs --disable-short-tags --enable-bcmath  --with-zlib-dir --enable-ftp --with-imap --with-mhash --with-mcrypt --with-pgsql --with-swf  --enable-sysvsem --enable-sysvshm --with-zlib --enable-iconv --with-kakasi --enable-jstring --enable-mbregex --with-namazu --with-gd=../gd-1.8.3/ --with-jpeg-dir=/usr --with-xpm-dir=/usr/X11R6
===== CONGIURE END ====


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-09 05:39 UTC] hholzgra@php.net
php 4 does only allow constants as class member initializers

expressions aka. calculations are not possible (while in php 3 
they were), use the constructor method instead ...

see also:
http://www.php.net/manual/en/x45905.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 16:01:27 2024 UTC