#24569 [Opn->Ver]: Zend Engine 2 doesn't recognize access to indizes of class array constants

From: Date: Wed, 09 Jul 2003 22:28:24 +0000
Subject: #24569 [Opn->Ver]: Zend Engine 2 doesn't recognize access to indizes of class array constants
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-43584@lists.php.net to get a copy of this message
ID: 24569 Updated by: sniper@php.net Reported By: rele at gmx dot de -Status: Open +Status: Verified Bug Type: Zend Engine 2 problem -Operating System: Windows XP SP1 +Operating System: * -PHP Version: 5.0.0b1 (beta1) +PHP Version: 5.0.0b2-dev New Comment: 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? :) Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#43584) next »