Buggy curly braces
Posted by Per Djurner on Feb 8
Due to my habit of leaving out curly braces on simple if/else statements a ColdFusion 9 bug hit me today. Have a look at the following code:
if (0==1)
tmp;
else
aStruct = {};
There's no reason that code should fail, right? But it does. When you run it you get an error message saying that "Variable ASTRUCT is undefined".
It looks like ColdFusion is misinterpreting the curly braces that declares the struct as being the end of the if/else statement. This is also proven by the fact that you can make the code run by adding proper curly braces to the if/else statement or using StructNew to declare the struct instead of the implicit declaration.
To make matters worse, this used to work in ColdFusion 8.
Anyway, off to Adobe to report it...