Title:
"<cfloop list=varName" without escaping the varName treats "varName" as a string
| View in TrackerStatus/Resolution/Reason: Closed/Withdrawn/AsDesigned
Reporter/Name(from Bugbase): Mosh Teitelbaum / Mosh Teitelbaum ()
Created: 03/13/2017
Components: Language
Versions: 2016
Failure Type: Incorrectly functioning
Found In Build/Fixed In Build: 2016.0.03.300466 /
Priority/Frequency: Normal / All users will encounter
Locale/System: ALL / Windows 10 64 bit
Vote Count: 0
Problem Description:
When using "<cfloop list=", if you use a variable whose value is the list contents as the value of the "list" attribute, without surrounding it with hashes/pound signs, ColdFusion treats the NAME of the variable as the list.
Steps to Reproduce:
{code}
<cfset theList = "1,2,3" />
<cfloop list=theList index="i">
<cfoutput>#i#<br /></cfoutput>
</cfloop>
{code}
Actual Result:
theList
Expected Result:
1
2
3
Any Workarounds:
Surround the variable name with hashes/pound signs as in:
<cfloop list=#theList# index="i">
Attachments:
Comments: