Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)
Created: 01/17/2013
Components: Language
Versions: 10.0
Failure Type:
Found In Build/Fixed In Build: Final / 284722
Priority/Frequency: Normal / Few users will encounter
Locale/System: English / Windows 7 64-bit
Vote Count: 8
Problem Description:
Sometimes a line of code which precedes another line of code which happens to have short-hand struct notation appears to be skipped. In the example below (courtesy of Brad Wood... I myself never managed to come up with a repro case for this, although I have experienced it on two occasions), the var var1 line is skipped.
This can be replicated on all versions of CF from 9->10.0.7 (latest at time of writing)
I discuss another case of this on my blog here: http://adamcameroncoldfusion.blogspot.co.uk/2013/01/shorthand-struct-notation-is-still.html#comment-771074783
And have experienced it also on completely unrelated other code as well. So as edge-case as the example seems, it is a real issue which crops up. Brad had encountered it too, obviously.
Steps to Reproduce:
<cfscript>
function callMe(){
if(1){ // always true, so always runs
var var1 = dummy(); // so var1 is definitely set
var var2 = dummy(test={bar=''});
}
// Try to use var1
var var3 = var1; // error on this line: "Variable VAR1 is undefined."
}
function dummy(){
return "";
}
callMe();
</cfscript>
Actual Result:
"Variable VAR1 is undefined."
Expected Result:
No error
Any Workarounds:
Don't use short-hand notation
--
Adam
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3482734
Keywords:
FixTested
External Customer Info:
External Company:
External Customer Name: Adam Cameron.
External Customer Email:
External Test Config: My Hardware and Environment details:
Attachments:
Comments: