tracker issue : CF-3502742

select a category, or use search below
(searches all categories and all time range)
Title:

Nested loop over [] array notation throws compiler error

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Chris Phillips / Chris Phillips (cf_chris)

Created: 02/19/2013

Components: Language

Versions: 10.0

Failure Type: Non Functioning

Found In Build/Fixed In Build: Final / 286287

Priority/Frequency: Critical / All users will encounter

Locale/System: English / Windows 7 64-bit

Vote Count: 1

Problem Description:
If you cfloop over the expression #[1,2]# as the value of the "array" attribute and do an inner loop from 1 to 2, CF will throw the exception "The CFML compiler encountered an unexpected java.lang.ClassCastException exception...".

Steps to Reproduce:
<cfoutput>
	<h2>cfloop over [1,2] (breaks)</h2>
	<cfloop array="#[1,2]#" index="i">
		<br>Outer: #i#
		<cfloop from="1" to="2" index="ii">
			<br>&nbsp;&nbsp; Inner: #ii#
		</cfloop>
	</cfloop>
</cfoutput>

Actual Result:
java.lang.ClassCastException: java.lang.Double cannot be cast to coldfusion.compiler.Node
	at coldfusion.compiler.SemanticAnalyzer.transformLiteral(SemanticAnalyzer.java:888)
	at coldfusion.compiler.SemanticAnalyzer.transform(SemanticAnalyzer.java:328)
	at coldfusion.compiler.Treewalker.postorder(Treewalker.java:100)

Expected Result:
Outer: 1
   Inner: 1
   Inner: 2
Outer: 2
   Inner: 1
   Inner: 2 

Any Workarounds:
Assign the array expression to a variable and use the variable as the value of the "array" attribute.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3502742

External Customer Info:
External Company:  
External Customer Name: cf_chris
External Customer Email:  
External Test Config: My Hardware and Environment details:

Windows 7

ColdFusion: 10,0,7,283649

Update Level: /I:/ColdFusion/InstanceDP1/lib/updates/chf10000007.jar

Attachments:

Comments:

Verified in CF10 Update 11 and Splendor latest build (Comment added from ex-user id:nawani)
Comment by Adobe D.
16271 | September 18, 2013 03:02:36 AM GMT
So it is marked as fix, but it needs to be released NOW. I just encountered it. WTF! How did this get through testing? Really don't want to litter new code with a work around that should never have to exist in the first place.
Vote by External U.
16272 | October 03, 2013 11:11:21 AM GMT