Per is using Posterous to post everything online. Shouldn't you?
6293_139066265637_610290637_3799410_6997109_n_thumb
Per Djurner
owns this site
6
subscribers
 
 

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...

Comments (0)

Leave a comment...

 
Got an account with one of these? Login here, or just enter your comment below.
Posterous-login    twitter


 
Loading...