Possible code generation bug or it could be me

Environment
Windows 2012r2
Scriptcase 9.4.016
PHP 7

I have a grid application with some code in the onRecord event that when I attempted to execute, I received an error.

Code:

if ({decision}==‘AA’) {++[aacnt];} else {[aacnt]=0;}

Error:

“Parse error: syntax error, unexpected ‘else’ (T_ELSE) in …”

When I looked at the line number of the Generated code I saw:

“if ($this->decision ==‘AA’) else”

I figured maybe I had a syntax error causing the half generated code. So I reformatted my code as follows to make it clearer to read.

if ({decision}==‘AA’) {
++[aacnt];
} else {
[aacnt]=0;
}

I could not see any issues so when I executed the application again with the reformatted code, the error went away. My only guess is that there is a bug with the code generator or am I missing something as to why code can’t be formatted as my first attempt? This is not a show stopper but I thought that it would be could to put it out here just in case it’s a bug.

Not an expert by any stretch… but shouldnt this line:
++[aacnt];

be

[aacnt]++;

?

Preincrements and postincrements are both standard php.

Afaik, when not used to assign a value to a different var (e.g. “$v = ++$i;” or “$v = $i++;”) they can be used interchangeably.

Change your first code to { ++[aacnt]; } and { [aacnt]=0; }

Problem is not the reformat itself, but the curly brackets not respecting space. Parser probably is going crazy there. Try to fit to coding styles, closed curly braces has a meaning in PHP and because SC parses your code to generate the final PHP code, probably for some reason misinterprets there.
BTW, it works on a blank app.