Title:
Unexptected behaviour when using cfloop query + ArrayAppend + ['column'] syntax
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/Fixed
Reporter/Name(from Bugbase): Jonas Meller / Jonas Meller ()
Created: 02/24/2017
Components: Language
Versions: 2016,11.0,10.0
Failure Type: Others
Found In Build/Fixed In Build: 2016.0.03.301771 / 308013
Priority/Frequency: Normal /
Locale/System: / Windows 7 SP1 64-bit
Vote Count: 0
Problem Description:
Unexpected behavior when using cfloop query + ArrayAppend + ['column'] syntax
I've tested 10,0,12,286680 and 2016.0.03.301771 and both show the unexpected behavior.
Steps to Reproduce:
<cfset q = QueryNew('name') />
<cfset QueryAddRow(q) />
<cfset QuerySetCell(q, 'name', 'John') />
<cfset QueryAddRow(q) />
<cfset QuerySetCell(q, 'name', 'Sarah') />
<cfset a1 = [] />
<cfset a2 = [] />
<cfset a3 = [] />
<cfloop query="q">
<cfset ArrayAppend(a1, q.name) />
<cfset ArrayAppend(a2, q['name']) />
<cfset x = q['name'] />
<cfset ArrayAppend(a3, x) />
</cfloop>
<cfdump var="#a1#" label="a1" />
<cfdump var="#a2#" label="a2" />
<cfdump var="#a3#" label="a3" />
Actual Result:
a1 = ['John', 'Sarah']
a2 = [['John', 'Sarah'], ['John', 'Sarah']]
a3 = ['John', 'Sarah']
Expected Result:
a1 = ['John', 'Sarah']
a2 = ['John', 'Sarah']
a3 = ['John', 'Sarah']
Attachments:
Comments: