ColdFusion 2016: Variable INDEX is undefined in CFLOOP

If you have some older code and you run ColdFusion 2016 and you use CFLOOP with a list and you have CFOUTPUT placed outside the loop than the code fails. I think this is very common.

Fails:

<cfoutput>
<cfloop list="test1,test2,test3,test4,test5" index="index" item="item">
	#invoke('mycomp', 'myFunction', {index=index,item=item})#<br />
</cfloop>
</cfoutput>

Workaround:

<cfloop list="test1,test2,test3,test4,test5" index="index" item="item">
	<cfoutput>#invoke('mycomp', 'myFunction', {index=index,item=item})#</cfoutput><br />
</cfloop>

We are currently waiting for the hotfix from Adobe.

Rating
Average: 8.4 (5 votes)