Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Jork Zijlstra / Jork Zijlstra (Jork Zijlstra)
Created: 05/20/2015
Components: Language
Versions: 10.0
Failure Type: Incorrect w/Workaround
Found In Build/Fixed In Build: Final /
Priority/Frequency: Major / All users will encounter
Locale/System: English / Linux Ubuntu 10.10
Vote Count: 0
Problem Description:
When looping over an list you can get the problem that the vale in the index isn't updated for each iteration. It remains the value that it got for the first time.
Steps to Reproduce:
<cffunction name="test" >
<cfset var key = javacast("null", 0) />
<cfset keyList = "key1, key2, key3, key4" />
<cfloop list="#keyList#" index="key">
<cfoutput>#key#</cfoutput>
</cfloop>
</cffunction>
<cfset test() />
Actual Result:
value of key remains key1
Expected Result:
value of key is updated for each iteration
Any Workarounds:
1) instead of using index "key" use "local.key"
2) delete index declaration before loop
Seems to work correctly in CF11. Didn't test it for cfscript.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3991492
External Customer Info:
External Company:
External Customer Name: Jork
External Customer Email:
External Test Config: My Hardware and Environment details:
Ubuntu 12.04, CF10,0,15,292620
Attachments:
Comments: