Reproduction
Use Opt 2.1 beta 1 and execute a post-increment operation (and probably other, related operations) on arrays, like in the example below.
Result
This results in really wired PHP code, which ends up with a parser error.
<?php echo $ctx->_data['list']++$ctx->_data['list']++['index']++; ?>
Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in foo.tpl.php
Expected
... parseable PHP code like the following.
<?php echo $ctx->_data['list']['index']++; ?>
Appendix
Using no arrays (from a template point of view), works. The following template creates the correct PHP code shown afterwards.
<?php echo $ctx->_data['foo']++; ?>
A similar problem (probably caused by the same reason) is an array assignment like the following template and compiled PHP code shows.
{$item.type is 'Location'}
<?php $ctx->_data['item']='Location'['type']='Location'; ?>
Workaroud
Create a copy of the array value and modify that copy.
Reproduction
Use Opt 2.1 beta 1 and execute a post-increment operation (and probably other, related operations) on arrays, like in the example below.
Result
This results in really wired PHP code, which ends up with a parser error.
Expected
... parseable PHP code like the following.
Appendix
Using no arrays (from a template point of view), works. The following template creates the correct PHP code shown afterwards.
A similar problem (probably caused by the same reason) is an array assignment like the following template and compiled PHP code shows.
Workaroud
Create a copy of the array value and modify that copy.