php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26431 Expressions in class constants using << don't seem to work?
Submitted: 2003-11-27 02:18 UTC Modified: 2003-11-27 04:04 UTC
From: jonny at sanriowasteland dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.0b2 (beta2) OS: Windows NT
Private report: No CVE-ID: None
 [2003-11-27 02:18 UTC] jonny at sanriowasteland dot net
Description:
------------
Class Constants cannot use  expressions, apparently they can only be numbers or strings.

This could be similar to bug #25323, but php does not crash, just returns a parse error.

Reproduce code:
---------------
<?php

class TestConstBreak
{
	const 	SOME_EXPRESSION = 5+5;
	const 	SOME_BIG_EXPRESSOIN = (5 + 2) * 3;
	const 	LS_EXPRESSION	= 5<<2;
	const	SOME_STRING_EXPRESSION = "foo"."bar";
}

?>


Expected result:
----------------
The expected result is to be able to use expressions in class constants without causing parse errors.

Actual result:
--------------
Parse error: parse error, unexpected '+', expecting ',' or ';' in php5Breakage.php on line 5

When I comment out line 5:

Parse error: parse error, unexpected '(' in php5Breakage.php on line 6

And when I comment out line 6:

Parse error: parse error, unexpected T_SL, expecting ',' or ';' in php5Breakage.php on line 7

And when I comment out line 7:

Parse error: parse error, unexpected ".", expecting ',' or ';' in php5Breakage.php on line 7


Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-27 04:04 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is as it should be... no bug here.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Aug 16 05:01:30 2024 UTC