ID:               24569
 Updated by:       [EMAIL PROTECTED]
 Reported By:      rele at gmx dot de
-Status:           Verified
+Status:           Closed
 Bug Type:         Zend Engine 2 problem
 Operating System: *
 PHP Version:      5.0.0b2-dev
 New Comment:

Not supposed to work.  Constants are a value/expression, you can only
use the [] opreator on variables.


Previous Comments:
------------------------------------------------------------------------

[2003-07-09 17:28:24] [EMAIL PROTECTED]

Not sure if this is even supposed to work, but 
I can confirm this:

PHP Parse error:  parse error, expecting `','' or `';'' in
/usr/src/web/php/php5/t.php on line 9

(strange, the error has changed? :)


------------------------------------------------------------------------

[2003-07-09 16:57:33] rele at gmx dot de

Description:
------------
The new per-class constants, introduced in PHP 5, don't allow to access
array indizes.
If I define an array as a constant of a class and try to access the
first index of this constant for example, the Zend Engine 2 gives a
parse error.
Only index access on a variable, that points to this constant, works.

Reproduce code:
---------------
Class Example {
  const CATEGORIES = array('a', 'b');
}

$c=Example::CATEGORIES;
echo $c[0] . "\n";
echo Example::CATEGORIES[1] . "\n";


Expected result:
----------------
a
b


Actual result:
--------------
PHP Parse error:  parse error, unexpected '[' in example.php on line 8


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=24569&edit=1

Reply via email to