#71: Cannot use constant as array index
Issue revisions
- new by mndWM8xG at 2010-M-15 0:00
| Type | |
|---|---|
| State | |
| Priority | |
| Resolution | |
| Assigned to | Nobody |
| Scheduled for | |
| Affected versions | |
| Affected components | |
| Last change | Saturday 15 May 2010 00:00:02 UTC by mndWM8xG |
Short description
Constants cannot be used as an array index within template files
...
Environment
...
Steps to reproduce
(In template file) This is my var {$ar.%FOO} This is my var {$ar[%FOO]}
...
Expected behavior
This is my var [X] This is my var [x] (where [x] refers to the value of $ar[FOO])
...
Actual behavior
Exception printed on screen
...
Jordi Boggiano at Sunday 18 July 2010 16:26:08 UTC
This is really non trivial to fix as it is, but use of constants is in general kind of a bad practice, so I would advise you to try and remove them, or just dump them to a variable first if really needed, like:
{$foo = %FOO} {$ar.$foo}