From: jonny at sanriowasteland dot net
Operating system: Windows NT
PHP version: 5.0.0b2 (beta2)
PHP Bug Type: Zend Engine 2 problem
Bug description: Expressions in class constants using << don't seem to work?
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
--
Edit bug report at http://bugs.php.net/?id=26431&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26431&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26431&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26431&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26431&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26431&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26431&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26431&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26431&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26431&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26431&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26431&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26431&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26431&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26431&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26431&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26431&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26431&r=float